Home
Project Folders
Teacher Resources
Student Resources
How Do I?
Literacy
MWForum
Site Map
Search
Our Team

MWForum Message [Date Index] [Threads] [Authors] [Attachments] [Subscribe]

[Thread Prev] [Thread Next]

To: mwforum@xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Subject: Re: comparing shapes in slot machine
From: LCSI <alain@xxxxxxx>
Date: Tue, 12 Feb 2008 12:12:21 -0500

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.


    © copyright 2001 - 2008