[Thread Prev] [Thread Next]
Try
to win
if (and (ask "t1 [shape]) = (ask "t2 [shape])
(ask "t2 [shape]) = (ask "t3 [shape]) )
[announce...]
end
or
to win
if (equal
ask "t1 [shape]
ask "t2 [shape]
ask "t3 [shape] )
[announce ...]
end
(t1's "shape) = (t2's "shape)(t2's "shape) = (t3's "shape))
[announce [you win] stopall]
end
Or, if you want to simplify the task of programming this, here is a
version that is a lot less elegant but easier to understand / debug
to win
make "sh1 ask "t1 [shape]
make "sh2 ask "t2 [shape]
make "sh3 ask "t3 [shape]
if (equal :sh1 :sh2 :sh3) [announce...]
end
if (and (t1's "shape) = (t2's "shape)(t2's "shape) = (t3's "shape))
[announce [you win] stopall]
end
Le 08-02-12 à 11:49, zehava wizman a écrit :
Hello Forum!
I have 3 turtles changing shapes randomally, I want to know each
turn wether the shapes are equel.
I want to do it without variables, and I try this proc:
to win
if (and (t1's "shape) = (t2's "shape)(t2's "shape) = (t3's "shape))
[announce [you win] stopall]
end
It doesn't work! Why?
thanks, Zehava
Be a better friend, newshound, and know-it-all with Yahoo! Mobile.
Try it now.
Previous by thread:
comparing shapes in slot machine
Next by thread:
Re: comparing shapes in slot machine
To save an attachment to your computer, PC users should right-click (Mac users, click and hold the mouse button) on the link and then choose 'save target as' from the pop-up menu. A window will then pop up in which you can choose a location for the file.
|