Posted: Wed Oct 14

Due: Thursday 10/15 10:00am

Submission name: w10_fizzbuzz_keys

Keyboard Controlled FizzBuzz!

  • Start of with a working version of the FizzBuzz program from work 7. If you do not ahve a functioning program, head on over to thesource and get it (reminder: if you’ve already cloned thesource into your home directory you just need to run git pull to get the latest updates.)
  • Add the following keyboard enabled controls to your program:
    • Pressing r should reset the counter back to 0.
    • Pressing the spacebar should toggle between pausing and playing. (there are multiple ways to do this, try to think of the simplest way. But think about what actually determines if the number in the middle of the screen changes?). Hint: You should not put the entire draw function body in a conditional statement.
    • Pressing a digit 1 - 9 should set the fizz value to that key.
      • Important note: char values can be used like numbers with arithmetic operators. (i.e. '5' - '0' –> ‘5’).
    • Pressing the up arrow should make the program run faster (you cannot change frameRate, but once again, what controls how quickly the number changes).
    • Pressing the down array should make the program run slower.

Runnable example: