js-bug-algorithm-simulator


Project maintained by r-downing Hosted on GitHub Pages — Theme by mattgraham

js-bug-algorithm-simulator

Robot simulator that runs bug algorithms. It was built with jQuery and an svg display.

How it works

The robot only has knowledge of three things: the global position of itself, the global position of the goal, and the point at which it is in collision with an obstacle, if any.

Right Turn Method

With this method, the robot moves straight toward the goal. If it hits an obstacle, it turns right and follows the wall until it has a straight path to the goal again.

This method can fail though…

Bug 1

The robot moves toward the goal. If it hits an object, it circumnavigates the object, keeping track of the closest it gets to the goal. Once it has completely circled the object, it returns to the closest point, then proceeds from there.

Bug 2

The robot moves toward the goal. If it hits an object, it remembers a line from the robot to the goal. It circles the object until it meets this line again at a place closer to the goal than the point of collision.

Simulator

Click to draw obstacle edges. Double-click to finish obstacle. Double-click inside obstacle to remove.

Click and drag to move robot or goal.

Right-click to choose an algorithm and run the simulation.

Run simulator below or open in new window


Home