NetLogo Homework

In this homework you are to write a Netlogo program that simulates the behavior of  a turtle as it wanders around the enclosure in search of the green bits of food. If it finds a food item it eats it.  Your program should move the animal until it eats all of the grass. You can put more grass than that inside of the fence if you desire.

You need to create the following interface

  1.  a grassct slider to set the number of grass nodules.
  2. setup button that clears the screen and creates a turtle that is colored white and has shape “turtle”
  3.  draw-fence button that uses a turtle to draw a fence in blue
  4. grass button adds ten random grass patches inside of the fence.
  5. wander button has the turtle run around the enclosure eating grass. When the grass is gone have it stop the program.  The main issue here is that it should change direction toward the center when it encounters the fence so it won’t escape.

Extra credit: add a monitor button, like that above, that gives the number of grass objects still uneaten.

More credit: Add any other cool feature you can think of.

Comments are closed.