Homework 9

Due Tuesday 9-Nov, at 10:00pm

For this hw, you may submit up to 999 times, but only your last submission counts.

While you may submit to Gradescope as often as you like for this assignment, there is no autograded portion, so you will be responsible for testing your code and making sure it meets the problem requirements. You do not have to write test cases for interactive, random, graphics, data initialization or event functions. Instead, you should test by visually inspecting your code’s behavior as you complete steps of each problem, where reasonably possible. This will make debugging your code much easier.

  1. Simon [100 pts] [manually graded]
    Special thanks to CA Huda Baig for designing and implementing this game.

    In this problem, you will build Simon, the classic 1978 game. We are providing you with a video demonstrating the game, and some random notes from the developers. You do not need to perfectly mimic our "look" for the game, and should feel free to improve upon it. (But don't make it look worse...) You are also free to add some additional features to the game for a chance at some extra credit.

    You are strongly encouraged to take notes as you watch the video, so that you don't need to watch it too many times.

    Here are some notes from a developer. These are intentionally vague and horribly incomplete, just like most software documentation is. So, your primary source of information should be the notes you take while watching the video above.

    General features of the game:

    • Starts with a menu screen indicating 3 levels (1 is easiest and 3 is hardest)
    • The game screen consists of 4 colored squares and an area to display the player's answers (mouse clicks in the answer display area does nothing)
    • The pattern flashes then the timer activates, decrementing in 0.5 second intervals
    • Mouse and key presses only register after the pattern has been flashed
    • The user can enter colors with mouse clicks or by navigating colors with the right and left keys and pressing the spacebar
    • The game continues, round after round, until the user makes a mistake
    • After gameover, the game can be restarted with 'r'

    How the countdown timer works:

    • The timer delay for the game is set to 100 ms
    • The timer decrements by 0.5 after every five timer fireds

    How the flashing works:

    • On easy, each color is "flashed" for 1 second, and there is 1 second in between colors
    • On normal, each color is "flashed" for 0.5 seconds, and there are 0.5 seconds in between colors
    • On hard, each color is "flashed" for 0.2 seconds, and there are 0.2 seconds in between colors

    Note on Extra Credit:
    For up to an additional 5 pts (maybe 10 if you do something truly amazing) add some creative, special features to the game. If you decide to do this...

    • Make sure you have all the basic features first, as extra credit is only available for fully-functional games.
    • Include a comment at the top of your file describing your feature and how we can test it.
    • Don't ask the course staff, "Is this enough for extra credit?" We won't answer such questions. If you have a fun idea and want to build it, then do.