Courses‎ > ‎Intro to CS - Full Year‎ > ‎Fall‎ > ‎Dyrland-Weaver‎ > ‎Work‎ > ‎

Work 11: 11/14

posted Nov 14, 2019, 11:09 AM by JonAlf Dyrland-Weaver
Write a NetLogo program with the following features.
  • Interface
    • num_reds: slider for the number of red turtles
    • num_blues: slider for the number of blue turtles
    • bomb_drop_chance: slider for % chance turtles drops a bomb
    • monitors to display the number of red and blue turtles.
    • buttons for the setup and go (forever) procedures, using the sliders where applicable.
  • Procedures
    • Setup (you should have this from Tuesday's class)
      • Takes 2 arguments representing the number of red and blue turtles.
      • Clear the world.
      • Create red turtles randomly scattered about the top of the world.
      • Create blue turtles randomly scattered about the bottom of the world.
    • Wiggle
      • Turtles should move forward 1 and rotate randomly as you see fit.
    • Go
      • Takes 1 argument representing the % chance a turtle "drops a bomb"
      • Turtles should wiggle
      • If a turtle lands on a black patch, it should have a chance to change the patch's color to its own, the chance is set by the parameter.
      • If a turtle lands on a patch of the opposite color (a "bomb"), the turtle should die and the patch should reset back to black.
      • Include wait to slow down your program.
Submit this as redVblue
Comments