12-13-13

posted Dec 13, 2013, 5:29 AM by Samuel Konstantinovich   [ updated Dec 13, 2013, 5:51 AM ]
If you think about your code using big ideas, and write functions to do those ideas, you will meet with more success.
Reminder: All of your cellular automata can be written in the following way using 'big ideas':
to go
  ask patches
  [   pickColor   ]
  ask patches
  [   changeColor   ]
  tick
end

PickColor will be different for different automata, but the separation of deciding what you want to be, and the changing into that new state must be clear. 

GOAL: State machines (not machines of the state)

ZOMBIE LAB:

World:
Make your world 51 by 51. (Think carefully what the max pxcor should be.)
Make your patch size fit on the screen appropriately.

Patches:
Each patch will have a new variable called state.
A patch is either alive, dead, or zombified.
All patches start out dead.

Dead patches: turn black, and stay black.
Alive patches: change to a random shade of green between (green + 2) and (green - 2), in increments of 0.1
Zombie patches: change to a random shade of red between (red+1) and (red - 3). They have a 1/100 chance to convert a neighbor living patch into a zombie (if a living neighbor exists)


Turtles: 
You will make two turtles the evil turtle (red) and the good turtle (green).
Both turtles wiggle around the world.
The evil turtle turns living patches in a 2 unit radius into zombies.
The good turtle kills zombie patches in a 4 unit radius, and turns dead patches in a 2 unit radius alive. 


Comments