Homework X, Bugs on a Plane

Short Description:

Write a program that will allow the user to explore the Four Bug Problem.

Goals

When you finish this homework, you should have:

Formal Description

In the classical four bug problem, four bugs start at the corners of a square and move toward the next bug conuter clockwise. We would like to build an application that allows users to explore this problem, or at least look at the pretty picture, when the number of bugs and corners is somewhat more variable.
You should build an application with a resonably well developed user interface that allows the user to You may add other computations if you wish, for example, you may provide an array of strings for the bug colors. Or turn on/off bug trails.
You should use a setTransform to place center of the computation in the center of the canvas. You may use any scale that you wish, I still worked in pixel coordinates with my polygon having "radius" min(canvas.width/2, canvas.height/2)*.9

Thinking of the coordinates (bug locations) as vectors makes computing the bug's movement very simple. A bug is at x,y looking at another bug at p,q. The vector (p-x, q-y) simulates this. Forming this as a unit vector (p-x,q-y)/d, where d = $\sqrt((p-x)^+(q-y)^2)$ gives a unit vector along the path the bug must travel, so the bug will move to (x+(p-x)/d, y+(p-y)/d). If you multiply the unit vector by the bug step size, you will get the coordinate to which the bug wishes to move. (Ask and we will go over this in class)
Your final result should resemble this picture where the polygon had 10 sides, there were 5 bugs each taking a 10 unit step eachupdate. an example of the expected output

Required Files

A tar/zip file containing all material required to display this homework should be sumbitted to D2L by the due date.

Submission

Submit the assignment to the D2L folder xxx by the due date.