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: Once again syntactic sugar only creates confusion.
From: "Daniel Ajoy" <da.ajoy@xxxxxxxxx>
Date: Thu, 07 Jun 2007 22:32:41 -0500
Dkim-signature: a=rsa-sha1; c=relaxed/relaxed;

I'm talking about the business of 

t1, blabla

instead of 

talkto "t1 blabla


I had adviced someone the following:


========================
The following seems to have a repetitive pattern that 
varies just a little:

when [touching? "t1 "t2] [setlives lives - 1 t1, seth 0 fd 30]
when [touching? "t1 "t3] [setlives lives - 1 t1, seth 0 fd 30]
when [touching? "t1 "t4] [setlives lives - 1 t1, seth 0 fd 30]
when [touching? "t1 "t5] [setlives lives - 1 t1, seth 0 fd 30]
when [touching? "t1 "t6] [setlives lives - 1 t1, seth 0 fd 30]
when [touching? "t1 "t8] [setlives lives - 1 t1, seth 0 fd 30]
when [touching? "t1 "t9] [setlives lives - 1 t1, seth 0 fd 30]
when [touching? "t1 "t10] [setlives lives - 1 t1, seth 0 fd 30]


one way to simplify it is using a procedure with an input:

to check.aggression :aggressor
when [touching? "t1 :aggressor] [setlives lives - 1 t1, seth 0 fd 30]
end

then all those lines can become:

check.aggression "t2
check.aggression "t3
check.aggression "t4
check.aggression "t5
check.aggression "t6
check.aggression "t7
check.aggression "t8
check.aggression "t9
check.aggression "t10

then if you ever want to change the way the aggression is 
handled you only need to modify the check.aggression 
procedure. Procedures are abstraction tools.

========================

Today, in another project I saw:


to check.aggression :aggressor
waituntil [touching? "shark :aggressor] :aggressor, [ht]
end


Notice:

:aggressor,


It doesn't work.


Why is MW syntax not consistent?


Daniel



  • Previous by thread: Class Wiki- student created
  • Next by thread: Online participation in EuroLogo 2007

  • 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