CMU 15-112: Fundamentals of Programming and Computer Science
Collab 4 (Due Monday 28-Sep at 8pm ET (Pittsburgh-time))




  1. Super Pong!
    Today you're going to add some neat new features to our Pong demo in the notes. The group will briefly discuss the following extra features, and just a bit about how one might implement them. Then, you and your partner(s) will try to add as many of these features as possible, starting from the Pong in the course notes. Your TA will make sure that at least one team from your group is working on each feature first. Note: We hope you will finish one of these within the allotted time, or perhaps even two, but you will not be graded on completion. Your code must demonstrate effort, however, and your TA should be able to see you have collaborated well.

    Here are the elements you must all implement:
    • Include a simple splash page (i.e. a title screen before you start the game)
    • Pressing a digit toggles the extra feature indicated by it's number below
    • Each time you toggle a feature, a 'toast' message appears notifying the value of that feature, and stays visible for 3 seconds (hint: use time.time())

    Now try to implement as many of these features as possible!

    1. Colorful Mode (press '1')
      This mode does the following:
      • Paddle becomes an interesting color
      • Dot changes colors based on position on the screen
      • "Dots Left" turns red when 2 or fewer dots are left

    2. Varying Speed Mode (press '2')
      This mode does the following:
      • The ball speeds up each time it hits the paddle
      • The speed resets each time the player starts a new round (i.e. with a new dot)

    3. AI Mode (press '3')
      This mode does the following:
      • The left paddle is controlled by an "AI" and not the keyboard
      • The AI should move the paddle at a speed of up to 5 pixels per timerFired call.
      • The target on the paddle should not always just be the middle of the paddle, because that would quickly get boring. Instead, each time the dot hits the paddle, choose a random "paddle target offset" which is a possibly-negative value that we add to the paddle cy to determine where the AI should aim for the paddle to intersect the ball.
      • While this paddle offset can in theory be up to half the paddle's height, limit it to about 40% of the paddle's height, since this seems to lead to more interesting and robust gameplay.

    4. Optional: Two-Player Mode (press '4')
      This is an optional challenging feature, for those with time and inclination after collab4, and once the other three features are complete. This would be only for fun, not for bonus points. In two-player mode, there are two paddles! The paddle on the right is controlled by two keys of your choosing besides 'Up' and 'Down' (or you can flip it so 'Up' and 'Down' control the new rightmost paddle). Note that you can enable and disable AI Mode when in Two-Player mode. When enabled, AI controls the left paddle, and the human controls the right paddle.


  2. Discuss solutions to Super Pong
    TAs will lead a discussion where all teams work together to derive the code that implements features 1, 2, and 3. As before, your TA will be individually grading you based on demonstrated effort and good collaboration, so participate!



  3. Video Discussion: Voting Machines
    Watch this video on election security and then this video on voting machines and discuss! This is open-ended, though here are some starter questions if you need them:
    1. Does this affect your faith in electronic voting machines?
    2. In the future, do you think we will be able to trust electronic voting machines?
    3. What does this tell us about other electronic systems we design?
    4. Does this make you any more or less inclined to take a course in computer security?

    Note: You are graded on attentiveness, participation, and courtesy. (Please pay attention and be respectful.)



  4. Midterm 1 Logistics
    Do you have logistical questions about the midterm? Perhaps you'd like some advice on how to prepare? Your TA is available to help!





    SUBMIT TO AUTOLAB!
    Note the submission deadline at the top of the page. You must submit to autolab by that time. The time is in ET (Pittsburgh time). We strongly recommend you submit immediately after your group is finished! No work will be accepted after the deadline (unless of course your collab meeting is after the deadline).

    Submit collab4.py to Autolab (Note: this is a python file, not a zip file!).
    All you need to submit in collab4.py is your Super Pong game, with as many features as you were able to add!

    (It is ok if you did not add all of the features, and while we hope your file runs, you won't receive a zero on the collab if it doesn't, as long as we can see your genuine effort in the code.) You are graded on demonstrated effort during the collab session, and your submission should provide extra evidence of that effort. There is no autograder.

    If you realize you messed up your submission (i.e. submitted a blank file, zip file, etc) you can submit up to 5 times, but you really ought not need to.

    Remember, no late work is accepted! Uploading to autolab takes a few minutes at most. Do not wait until the deadline and risk getting a zero.