Part A: Viewfinder 3.0

Assignment two drew a viewfinder version 2 (VF2.0) containing markers along the circumference, drawn using a loop.

You need to update the viewfinder design such that the new viewfinder (VF3.0) now has a a structure like spokes in bicycles. The viewfinder should resemble the sample provided here. The spokes must be drawn using a loop.

Diameter of the inner circle (no border, semi-transparent black fill) of each viewfinder should be between 30 and 60 (inclusive) such that different viewfinders have different sizes. Diameter of the outer circle (black border, no fill) is twice that of the inner circle. Six white equidistant spokes with stroke weight 5 should be drawn.

Part B: Many viewfinders

As your main task, you are required to create multiple viewfinders, using a loop (no marks if a purposeful loop is not used). These viewfinders must satisfy following criteria.

  • There are a maximum of N viewfinders at any stage on the display window. N should be randomised between 5 and 20 (inclusive) for each execution of the program
  • The viewfinders all drop slowly from above the display windows towards the bottom and when they completely go below the window, they regenerate from a random xlocation from the top again.
  • Each viewfinder travels at a different speed, each initialised to a random floating point value between a minimum speed and maximum speed (minimum speed = 1 and maximum speed = 3 in sample video)
  • Each time a viewfinder is regenerated due to falling off the display window, its speed is reset to a value between a minimum speed and maximum speed.

Part C: Hitting viewfinders and effect

HIT If a viewfinder is hit within the inner circle, it is be regenerated with a 10% higher speed, and other viewfinder speeds should also increase by 10%.

MISHIT If a viewfinder is hit outside the inner circle but inside the outer circle, it should be regenerated with a 10% lower speed, and speed of all other viewfinders should also increase by 10%.

Now the fun part - since a single hit can actually hit zero, one, or more viewfinders (some inside, others outside), the above two rules should be observed for each viewfinder sequentially. (They should be observed for viewfinder 1, then viewfinder 2, and so on till the last viewfinder).

Let’s say you hit viewfinder 1 and 4 inside the inner circle and viewfinder 3 outside the inner circle but inside the outer circle with a single mouse press. Because you hit viewfinder 1, speed of all viewfinders increases by 10%. Then, because you mishit viewfinder 3, speed of all viewfinders decreases by 10% (Note that this reduction of speed is on the increased speed owing to hitting viewfinder 1). Then, because you hit viewfinder 4, speed of all viewfinders increases by 10% (Note that this increase in speed is on the decreased speed owing to mishitting viewfinder 3).

Part D: Scoring

Each hit contributes 10% to the percentage mission accomplished, and each mishit takes away 10% from it (bounded on the lower side by 0, that is even if you have mishits once mission accomplished percentage is 0, it doesn’t decrease beyond that). The change in percentage is computed once for every mouse press. Let’s say you hit viewfinder 1 and 4 inside the inner circle and viewfinder 3 outside the inner circle but inside the outer circle with a single mouse press. The net change in percentage mission accomplished is (+2*10-1*10 = +10). Once the percentage reaches 100%, the game is over.

(20%) You are required to keep a track of the number of viewfinders hit, and the number of viewfinders mishit during the duration of the game. For each hit viewfinder, a green circle is drawn, and for each mishit viewfinder, a red circle. For each miss (neither hit nor mishit) during a mouse press, a black circle is drawn. The order of the circles should be in the order of these events happening. As in assignment 2, if there is not enough space on a row for all circles, the rest of the circles should be drawn on the next row, starting from the left again.

Half of these 20% marks are for doing it right, and half of the marks are for filling the correct colours in the circles WITHOUT using conditions. This should provide an adequate challenge for students striving for high distinction.

(5%) A pie representing percentage mission accomplished should be drawn on the bottom left of the display window. Full pie represents 100%, half pie represents 50% and so on

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.