When you open the NetLogo, The first interface you see is the simulation area. In order to access the coding area you need to click on the 'code' tab which is located just under the menu bar.
Compared to programming in a language like Java, there are differences in building simulations in NetLogo. The main difference I noticed is instead of curly brackets, square brackets are being used when using conditionals. When using the keyword 'self', we are not referring to the turtle itself, but to the turtle, we are asking something to do. To refer to the agent itself the keyword 'myself' should be used.
The best thing is, that whenever I place a button or a slider in the GUI area, I can refer to their values simply by mentioning the name of the element.
There are several other important things to keep in mind when dealing with NetLogo programs I noticed so far (There should be more) but those can be found in the interactive dictionary.
NetLogo refers to the agents in the simulations as turtles. If I need only one type of agent, I can simply go with the turtles. However, I need two types of agents in the simulation. In my case the bots who do the searching and the target which is being searched for. So need to create two types of turtles. I can do this by using 'breed' primitive. For each of these types, I can assign features and their own variables which will be used during the simulation.
Here is the very first NetLogo program I created after hours of experimenting by myself and then going through the documentation. (There are some additional GUI elements as I am experimenting now) It simply creates 2 types of breeds. As of now the bots will just spawn in random places in the environment and move forward. The target stays in the middle. No goal detection or any other logic is implemented as of now.

No comments:
Post a Comment