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: Zehava's snake
From: "Menefee, Mike - OC" <Mike@xxxxxxxxxxxxxxx>
Date: Thu, 11 May 2006 13:30:41 -0700

Hi All,

I did mine in EX.  I wonder if this is something like Zehava had in
mind.  Use the arrow keys to "steer."

It works pretty well, unless you aim directly for a wall!  Then some
"interesting" things occur.

I would be interested in some more advanced users paring out the
inelegant features.  There is much I need to learn.

:)

Mike

PS

Here is the code.  I hatched 7 turtles and then ran the procedure called
setup

+++++++++++++

to setup
everyone [home seth 90]
t1, fd 120
t2, fd 100
t3, fd 80
t4, fd 60
t5, fd 40
t6, fd 20
t1, seth 145
make "turn 0
make "step .2
forever [slither]
forever [steer]
forever [follow]
forever [bounce]
end

to follow
t2, 
make "mystep (distance "t1) - 20
fd :mystep check2
t3, fd :mystep check3
t4, fd :mystep check4
t5, fd :mystep check5
t6, fd :mystep check6
t7, fd :mystep check7
end

to slither
t1, fd :step rt :turn
end

to steer
make "key ascii readchar
if :key = 37 [make "turn -.3]
if :key = 39 [make "turn .3]
if :key = 38 [make "turn 0]
if :key = 40 [make make "turn 0 "step 0]
end

to bounce
t1,
if (abs ycor) > 140 [seth 180 - heading fd 2]

if (abs xcor) > 250 [seth 360 - heading fd 2]
end

to check2
if 20 < distance "t1 [fd :mystep towards "t1]
end

to check3
if 20 < distance "t2 [fd :mystep towards "t2]
end

to check4
if 20 < distance "t3 [fd :mystep towards "t3]
end

to check5
if 20 < distance "t4 [fd :mystep towards "t4]
end

to check6
if 20 < distance "t5 [fd :mystep towards "t5]
end

to check7
if 20 < distance "t6 [fd :mystep towards "t6]
end

-----Original Message-----
From: mwforum-admin@xxxxxxxxxxxxxxxxxxxxxxxxxxxx
[mailto:mwforum-admin@xxxxxxxxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Daniel
Ajoy
Sent: Thursday, May 11, 2006 11:45 AM
To: mwforum@xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Subject: Re: turtle after turtle

On 11 May 2006 at 5:03, zehava wizman wrote:

> Hello Forum!
>   here attached a project. The moving of the turtles is changes by 
> using ascii keys.
>   but when I pushed some key, and the direction is changed, I want the

> other turtles first reach the exact point that turtle T1 changed its 
> direction' and then turn to the same direction.Its doesn't work so 
> yet.( I saw in the forum similar project with FOLLOWLINE procedure but

> my needs are a little diffrent).
>          thanks, Zehava Wizman
> 

Sorry,

Here is my failed attempt.

Daniel

Attachment: snake.mwx
Description: snake.mwx


  • Previous by thread: MIA, Ask an Expert: Greatest Common Factor
  • Next by thread: RE: Zehava's snake

  • 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