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] <

To: mwforum@xxxxxxxxxxxxxxxxxxxxxxxxxxxx, Lee Mackie <mr_Wiggl3z@xxxxxxxxxxx>
Subject: Re: MIA, Ask an Expert: swerve randomly between 2 integers
From: "Daniel Ajoy" <dajoy@xxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 12 Aug 2005 10:28:13 -0500

On 12 Aug 2005 at 9:54, Ask an Expert - Question wrote:

> from: Lee Mackie <mr_Wiggl3z@xxxxxxxxxxx>
> date: Fri Aug 12 01:10:44 2005
> 
> Is there a way I can make a turtle swerve randomly between 2 integers.
> 
> For example,
> in your race car game, they swerve around their lanes, and if they crash 
> into eahc other 
> it says they crashed and a an outcome to the race cannot be found?
> 
> Thanks,
> Lee Mackie
> 

Hi Lee,

A sample project is attached. I'll discuss the following expression:

30 * (-1 + 2 * random 2)

"random 2" gives either of two values: 0 or 1

"2 * random 2" gives either of two values: 0 or 2

"-1 + 2 * random 2" gives either of two values: -1 or 1

"30 * (-1 + 2 * random 2)" gives either of two values: -30 or 30

Daniel






*****************************
OpenWorld Learning
http://www.openworldlearning.org

Attachment: Swerve.mw2
Description: Binary data


  • Previous by thread: MIA, Ask an Expert: swerve randomly between 2 integers

  • 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