1. Robot challenge -Reply
- Posted by Jay Turley <jturley at MDC.COM> Nov 05, 1998
- 412 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
2. Re: Robot challenge -Reply
- Posted by Irv Mullins <irv at ELLIJAY.COM> Nov 05, 1998
- 393 views
On Thu, 5 Nov 1998 11:39:12 -0600, Jay Turley <jturley at MDC.COM> wrote: >Irv- > >A few more specs would be useful... How may sensors does the robot >have? I leave that up to the coder. > What can they detect? Imminent collision with the wall - minimum. Don't trash the wall when colliding. Also helpful if they could detect collision with another 'bot (for later bot wars) >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 Sounds like a reasonable start. >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? Again, up to the coder. Do you go for simple and fast, (head banger) or complex and slow (chess master) mode? >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 Oh. I forgot to add, we need to see the bot moving on screen - maybe a nice circle would be enough - some color other than yellow/red/green. Get fancy if you wish. I realize that if your algorithm is good, the bot will move so fast it will be hard to see. Might be interesting, tho, to stick in a time delay to see how it works. Naturally we'll include a timer at the call and at the exit of the 'bot routine, and time them all on the same pc. Regards, Irv