15-112 Fall 2012 Homework 8
Due Sunday, 28-Oct, at 10pm

Read these instructions first!


  1. Tetris
  2. Snake Tutorial
  3. More Snake
  4. Bonus: Line Runner

  1. Tetris Tutorial  [40 pts]
    Note:  this game should run when the user presses '1' from the launch screen.
    This problem is COLLABORATIVE.  You may work in groups of up to 4 students (yourself included).  Write Tetris exactly according to the design given in this step-by-step tutorial. You may not use a different design (except for eliminating globals), even if you think there's a better way to do it (there probably is, but you still have to do it this way).
     
  2. Snake Tutorial  [30 pts]
    Note:  this game should run when the user presses '2' from the launch screen.
    This problem is COLLABORATIVE.  You may work in groups of up to 4 students (yourself included).  Carefully follow all the steps in this step-by-step Snake Tutorial.  Of course, you are ultimately given the answer in the tutorial.  Even so, while you may consult that solution, you may not simply copy and submit that version, but instead you must work through each step carefully and then submit the version that you typed in (and hopefully completely understood, from first principles) yourself, even if it is basically the same as the solution (as one would expect).  Be sure to list your name and andrew id and those of your collaborators (if any) at the top of the Snake section of your hw8.py submission.
     
  3. More Snake (SOLO)  [30 pts]
    Note:  this game should run when the user presses '3' from the launch screen.
    This problem is SOLO.  Still in hw8.py, but starting from the code in the snake8.py file at the end of the Snake Tutorial, add the following features:
    1. A pause feature, where the game pauses when the player presses 'p' for 'pause', and where the game resumes (exactly where it left off) when the user presses 'p' again.  While paused, the board should be visible, but the colors should be a bit dimmer than when unpaused.
    2. A score, which should be displayed at the top-center, above the board (which will have to be moved down by enough pixels to make room for the score).  The score should start at 0 for each game, and increase by 1 each time the snake eats food.
    3. A high score list, which should be displayed as part of the "Game Over" screen at the end of each game.  This is just a list of the 3 highest scores (during this execution; so if you exit and restart the program, the list is cleared), in sorted order from largest (on top) to smallest (on the bottom).  If there are fewer than 3 scores available, do not list the missing scores as 0's, but just do not list them at all (thus, you will list one score after the first game).
    4. Two levels.  Level 1 works just as described in the Snake tutorial.  But when the snake eats the 3rd piece of food, the game switches to Level 2, with the following changes:
      1. Speed-up:  make the game move noticeably faster, but not unplayably faster.
      2. Poison:  in addition to randomly-placed food, a separate randomly-placed piece of red poison is placed on the board (and of course not on the snake nor on the food).  If the snake eats the poison, it dies.  Note that you must be sure the poison is not placed one square away from the snake's head unless that is the only location remaining.
    5. Walls.  When the game is paused, the user can click with the mouse in empty cells to create walls (which are brown), or click on walls to remove them.  If the snake runs into a wall, it does not die, but rather it destroys the wall at a cost of 1 point.  If that would result in a negative score, then the snake dies.  At the end of a level, if any walls existed for at least 20 moves on that level, the score increases by 1 extra bonus point.  Do not remove the walls when placing new food or poison.
       
  4. Bonus:  Line Runner (SOLO) [up to 5 pts]
    Note:  this game should run when the user presses '4' from the launch screen.
    This problem is SOLO.  Line Runner is a simple, fun game available for Android and iPhones.  Find it, learn how it works, and then implement a game that is fairly close to it (not exact, since it uses touch events, and maybe you should use keyboard events seeing as your code will be running on a desktop and not a phone).  Don't go too crazy with this.  Keep it simple (for example, you can still get some points if the line runner is just, say, a rectangle (though it'd be much more interesting if you attempt the running animation))..  And have fun!


carpe diem   -   carpe diem   -   carpe diem   -   carpe diem   -   carpe diem   -   carpe diem   -   carpe diem   -   carpe diem   -   carpe diem