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: MIA, Ask an Expert: a turtle hits a wall
From: "Daniel Ajoy" <da.ajoy@xxxxxxxxx>
Date: Mon, 05 Jun 2006 18:06:13 -0500

On 5 Jun 2006 at 17:06, Ask an Expert - Question wrote:

> from: stephen <detzmarsh@xxxxxxxxxxx>
> date: Mon Jun  5 13:16:04 2006
> 
> I'm making a program. the program is, the turtle hits a 
> wall its suposed to bounce off but the turtle just goes 
> through the wall. i put [ if heading 15 seth 345 ] and so 
> on and so on but it didnt work.
> 
> I am using microworlds 2.0 
> 

Hi Stephen,

In: fd 10

"fd" receives one thing, a distance, the number 10.

In: if ... ...

"if" receives two things: a word and a list

if {WORD} {LIST}

the {WORD} needs to be true or false

the expresion 

1 = 1

is equivalent to the word TRUE

while, if the turtle is heading down the following expresion is
equivalent to the word FALSE

heading = 15

this is what we have so far:

if heading = 15 {LIST}

The {LIST} is not any kind of list, it is a list of instructions.
For example

[fd 10 rt 90] 

or 

[seth 345]

It cannot be a list such as

[345 seth]

or

[1 2 3]

or

[alice bob carl daniel]

So, in the following:

if heading = 15 [seth 345]

"if" receives two things:

1. The word resulting from the evaluation of 
heading = 15
This word should be either TRUE or FALSE

2. The list [seth 345]

If the word is TRUE, then "if" executes the list.


Daniel


PS. Maybe the following is an even better solution:

if heading = 15 [seth 345 fd 10]





  • Previous by thread: MIA, Ask an Expert: a turtle hits a wall
  • Next by thread: Re: MIA, Ask an Expert: a turtle hits a wall

  • 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