Hey all I found this very interesting idea in a book (The Robot Builder's Bonanza) for a way to code a robot. Instead of having a robot that merely goes straight till it hits something you have several "levels" or "layers" of code. The first one being an obstacle avoidance sorta thing, and then on the next level an aimless wander. This wander section of code which would ask the obstacle avoidance level if it was OK to move. If it was OK then the random wander would do its magic but if there was an obstacle then the obstacle avoidance would take over like a sort of reflex.