Robot challenge -Reply
- Posted by Jay Turley <jturley at MDC.COM> Nov 05, 1998
- 491 views
Irv- A few more specs would be useful... How may sensors does the robot have? What can they detect? Can we assume helper functions, like: wall() - returns True if position is "on" wall, False otherwise green() - returns True if on green square, False otherwise red() - returns True if on red square, False otherwise Also, what length do the sensors go out to? One pixel? Ten pixels? what kind of movement functions does the robot have? And how far do they move it? Assuming one forward-looking sensor with a range of one pixel, the helper functions above, and a move function that moves forward one pixel, and turn functions that turn x degrees clockwise, a simple algorithm would be: while !red() do forward() if wall() then turn(180) forward() turn(270) end if end while