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, David Burke <burkd1@xxxxxxxxx>
Subject: Re: MIA, Ask an Expert: abs xcor ycor and heading
From: "Daniel Ajoy" <da.ajoy@xxxxxxxxx>
Date: Tue, 20 Nov 2007 10:46:37 -0500
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed;

On 20 Nov 2007 at 3:35, askanexpert@xxxxxxxxxxxxxxxxxxxxxxxxxxxx wrote:

> from: David Burke <burkd1@xxxxxxxxx>
> date: Tue Nov 20 03:35:08 2007
> platform: Mac OS10
> version: MicroWorlds Ex
> 
> I have a game where my students have to navigate a polygon 
> maze to win.  I want to check if there turtle is within a 
> specified distance of the target.  I want their xcor, ycor 
> and heading to be within 0.25, or any other chosen 
> precision.  I was trying to get the ABS command to work for 
> this with no luck.  Here is what I was trying:
> 
> ifelse abs 150 - xcor < 0.25 [pr [yes]] [pr [no]]
> 

this is understood by MW as follows:

ifelse (abs ((150 - xcor) < 0.25)) [pr [yes]] [pr [no]]

you want:

ifelse 0.25 > abs 150 - xcor  [pr [yes]] [pr [no]]

because MW understands this as follows:

ifelse (0.25 > (abs (150 - xcor))) [pr [yes]] [pr [no]]


There *is* a primitive called "distance" you might want to
check it out.


Daniel
OpenWorld Learning



  • Previous by thread: RE: MIA, Ask an Expert: abs xcor ycor and heading

  • 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