ROADRULES I have trialled a road rules simulation in MicroWorlds. The original suggestion was from Julie Clune (Woodlands CEGGS). I jumped at the idea because I thought it would really motivate kids. In the first lesson that I introduced this topic one student who had hitherto been poorly motivated and inarticulate suddenly found his voice and explained clearly to the class and me the hierarchy of give way rules. I knew then that I was onto a winner. What he said was (comparisons with other countries may be interesting) that the correct order in deciding whether or not to give way was:- 1. pedestrians 2. traffic lights 3. Tee intersection 4. right 5. breaking into traffic 6. left turn before right turn Nevertheless, it proved tricky to program situations where cars might collide and students needed lots of help here, which is why I have developed the code below. I also received a question from Janette Emerson about a similar program involving pedestrians crossing at lights. I think what I have coded below could be adapted to that. Here are the procedures to simulate cars meeting at a T intersection. The procedure controlling the car starting on the left of the T is called west (turtle t3); the procedure controlling the car on the right of the T is called east (turtle t1); the procedure controlling the car starting at the bottom of the T is called north (turtle t2). You need a button called go and another called reset. You need 3 sliders, called speed.west, speed.north and speed.east, all set on a maximum of 5. The procedures that follow use the timer to change the speeds of the car randomly to make it more realistic. One consequence of that is that backend collisions as well as collisions at turns are possible too. This just arises naturally out of varying the car speeds randomly. If a collision is about to occur the test procedure stops everything and asks the question: who should have given way? That is as far as I have gone so far. This is written for MicroWorlds version 1. I's be interested in ideas about developing this program further or adapting it to similar situations -- it a natural self motivator for older kids in particular. -- Bill Kerr to go forever [test] launch [west] launch [north] launch [east] end to west t3, if xcor > -6 [seth 180] if ycor < -140 [reset.west] vary.speed.west launch [ fd speed.west] west end to vary.speed.west if timer > 9900 [resett] if (remainder random timer 100) = 0 [setspeed.west 1 + random 5] end to north t2, if ycor > 37 [seth 90] if xcor > 250 [reset.north] vary.speed.north launch [fd speed.north ] north end to vary.speed.north if timer > 9900 [resett] if (remainder random timer 100) = 0 [setspeed.north 1 + random 5] end to east t1, if xcor < -7 [seth 180] if ycor < -150 [reset.east] vary.speed.east launch [fd speed.east] east end to vary.speed.east if timer > 9900 [resett] if (remainder random timer 100) = 0 [setspeed.east 1 + random 5] end to reset.west t3, setpos [ -200 40] seth 90 setspeed.west 5 end to reset.east t1, setpos [287 -2 ] seth 270 setspeed.east 5 end to reset.north t2, setpos [-68 -147] seth 0 setspeed.north 5 end to reset cc resett t1, reset.east t2, reset.north t3, reset.west end to test t1, if (distance "t2) < 25 [cc show [who should have given way?] stopall] t1, if (distance "t3) < 25 [cc show [who should have given way?] stopall] t2, if (distance "t3) < 25 [cc show [who should have given way?] stopall] end -- Bill Kerr --------------------------------------------------------------- Please post messages to the Logo forum to logo-l@gsn.org. Mail questions about the list administration to logofdn@gsn.org. To unsubscribe send unsubscribe logo-l to majordomo@gsn.org.
Global SchoolNet Foundation -
Linking Kids Around the World!
Copyright GSN - All Rights Reserved
- Comments
& Questions
Visit GSN's
Global
Schoolhouse for more exciting learning resources!
Search our Site
-
Home