View this PageEdit this PageAttachments to this PageHistory of this PageHomeRecent ChangesSearch the SwikiHelp Guide
Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007

Sp2001 Midterm Review: Coding the Robot Car

Code the robot car:

Shouldn't that be a right turn?
What does analogous mean? No clue about that..
The comment says that the given code is about bumping the left front bumper. What should happen, then, for bumping the right front bumper? Mark Guzdial

sensor = 11
ifTrue:
[ "Assume that we1ve bumped our front left bumper"
"Shift all wheels into reverse gear"
  1. ('a' 'b' 'c' 'd' 'e' 'f') do: [:each | each shiftRear.]
"Activate all wheels for one second."
wheelsController activateFor: 1.
"Shift right side wheels into forward gear."
  1. ('d' 'e' 'f') do: [:each | each shiftForward.].
"Makes right wheels go forward while left wheels go reverse – right turn."
wheelsController activateFor: 1.
].

The exact same thing - except for a right turn.
Jaroslav Tyman (whew... look at the time)



Link to this Page