11
|
|
Let's play around with your new copy
of the Noughts & Crosses project by typing commands in the
Command Centre, learning as we go.
Recall that we have nine turtles -
you can see them all by typing everyone [setshape "cross]
There is always a "current turtle", the one we are
currently talking to. You can find out which by typing
show who. Note that if you click on a turtle,
it becomes the current turtle. We can find out the current turtle's shape thus:
show shape.
So every turtle has a property called shape.
But we need each turtle to have a value also: 0 for blank,
1 for nought and 4 for cross. Well, we can give every turtle a new value property:
turtlesown "value - it's that easy! Now we can try commands like:
setvalue 1 or
show value or
t7, show value or
everyone [setvalue 0] or
everyone [show value] or
make "v1 value.
We can now write the
do_cross and do_nought procedures.
We can also add a line to the clear and
ox procedures.
Try before moving on.
|