jSIMPLEBUG: a Swarm tutorial for Java
This tutorial takes the user through the development of a Swarm model using the Java programming language. The model itself is a very simple one, but the application we build step by step around it makes use of a lot of the functionality of Swarm and demonstrates many of Swarm’s features. This Java-based tutorial borrows heavily from an earlier Objective-C-based tutorial by Chris Lanton and the Swarm development team. Indeed, the Java code is pretty much a loose translation of their Objective-C code and portions of the text are theirs as well. There are a number of changes, however, to reflect this tutorial’s focus on using Swarm with Java rather than Objective-C.
We start out with a very simple Swarm simulation, one agent, a “SimpleBug,” taking a random walk on the X,Y plane. Through a progression of models we increase the number of agents and introduce basic object-oriented and Swarm-style programming in Java. The final version implements an experiment in which multiple invocations of the SimpleBug model are created, run, analyzed, reported on, and dropped. Along the way, we introduce many of the functions that Swarm provides for creating and interacting with multi-agent, artificial worlds. Although this is a relatively simple exercise, hopefully it will show how easy it can be to build fairly complex models from the simple building blocks provided by Swarm.
Once you have gone all the way through this tutorial, you should be able to make sense of many of the applications on the Swarm web-site. Upon first look, these applications appear quite complex. However, once you get a feel for the underlying patterns they are really not that hard to understand and you are encouraged to build upon them for your own applications.
Get pdf download jSIMPLEBUG: a Swarm tutorial for Java
Related Tutorial
Tags: building blocks, c code, functionality, invocations, java code, java programming language, lanton, loose translation, models, Objective C, random walk, simple exercise, simulation one, swarm web
Comments
Leave a Reply