Date: 2's-day, i.e. Two's-day 02/02/2010 Tuesday, 2 Feb 2010 19:48:03 -0600 (Central Standard Time) From: Mark Jacobson To: 810-025-01-spring@uni.edu Subject: More help on the NetLogo EVEN and ODD turtles... Hi 025 students, Here is an answer made earlier this evening to a student's questions about the NetLogo EVEN and ODD turtles task. Read it carefully if you are still having trouble with that. Mark ---------- Forwarded message ---------- Date: Tue, 2 Feb 2010 18:30:03 -0600 (CST) *** 6:30 p.m. *** From: Mark Jacobson To: Frodo Baggins Subject: Re: EVEN and ODD turtles... ifelse (remainder who 2 = 0) On Tue, 2 Feb 2010, Frodo B. Baggins wrote: > Mark, > > I am stuck on trying to make the turtles go foward......... > i don't even know where to begin. > i've tried it a few times and it has a million errors. I guess > the biggest problem is I don't know how to put the command in for > ifelse (remainder who 2 = 0)? what does this mean? > > thanks, > frodo > > btw - bilbo says to say hi... Hi Frodo, did you not get my email message an hour or two ago about the ifelse (remainder who 2 = 0) [ have EVEN turtles go forward with fd 10 or fd 25 ] [ have ODD turtles go forward with fd 5 or fd 12 ] ??? VIP update to this page: ------ http://www.cs.uni.edu/~jacobson/logo/applets/FlyFishing.html ---------------------------------------------------------------------------- Here is the key to the above Flying and Fishing animation: ---------------------------------------------------------------------------- ifelse (remainder who 2 = 0) [ fd 3 wait 3 set shape "airplane" wait 2 pd set pen-size 4 fd 8 ] [ fd 6 wait 3 set shape "fish" wait 2 pd fd 3 pu fd 1 ] Every turtle has a WHO number. REMAINDER who 2 gives a remainder of 0 (zero) for all turtles who have an EVEN who number. REMAINDER who 2 gives a remainder of 1 for all turtles that have an ODD who number. Here is the general pattern that you apply: ifelse (remainder who 2 = 0} [ what to have the EVEN numbered turtles do ] IF CLAUSE part [ what to have the ODD numbered turtles do ] ELSE CLAUSE ifelse ( something that is either TRUE or else it is FALSE ) ---- [ what to DO if it was TRUE ] Do this first [ ] part if TRUE [ what to do if it was FALSE ] or ELSE do this 2nd [ ] part if it was FALSE ifelse ( logical condition - True or False condition ) [ TRUE actions ] also known as THEN clause [ FALSE actions ] also knows as ELSE clause ---------------------------------------------------------------------------- http://www.cs.uni.edu/~jacobson/logo/applets/FlyFishing.html Here is the key to the above Flying and Fishing animation: ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- Let me know if this helps or not. ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- TO fishOrAirplanes ca ;; clear all previous drawing and turtles cro 16 ;; create 16 ordered turtles ask-concurrent turtles [ set size 3 ifelse (remainder who 2 = 0) [ fd 3 wait 3 set shape "airplane" wait 2 pd set pen-size 4 fd 8 ] [ fd 6 wait 3 set shape "fish" wait 2 pd fd 3 pu fd 1 ] ] END ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- It does not matter whether you say: ASK TURTLES or ASK-CONCURRENT TURTLES for your assignment. Good luck, Frodo! Mark P.S. Tell Bilbo hello from Cedar Falls and UNI.