Your instructor will assign one or more of the following problems. Submit all appropriate files for grading, including code files, screen captures, supplemental files (e.g., image files), and text files.

  1. Write a program that draws a triangle in the middle of the screen, and then the three points of the triangle move a bit after each frame in a brownian fashion. The color of the triangle (both the line and the fill) should be random, as should the thickness of the line. When a user runs your program, clicking the mouse should result in a new random color and thickness of the line for the outline of the triangle. When a user presses any key, the inside color of the triangle should change to a new random color. You should ensure that the three points never leave the screen. See an example below.

  2. Write a program that starts with a circle in the middle of the screen, and then the x-y coordinates change a bit after each frame in a brownian fashion. The color of the circle (both the line and the fill) should be random. When a user runs your program, clicking the mouse should result in a new random line color for the outline of the circle, and the circle should start moving from the location of the mouse click. When a user presses any key, the inside color of the circle should change to a new random color and the diameter of the circle should also change in a brownian fashion. You should ensure that the x-y coordinates never leave the screen, and that the circle never has a diameter larger than 50 pixels. See an example below.