Robot challenge -Reply

new topic     » topic index » view thread      » older message » newer message

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

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu