15-112 Spring 2016 Homework 7
Both parts are due Sunday, 28-Feb, at 10pm

Read these instructions first!
Hw7c: Tetris (COLLABORATIVE)

This portion of hw7 is "hw7c", where the "c" means "Collaborative". This problem (Tetris), and only this problem, is optionally collaborative. You may work in groups of up to 2 currently enrolled 15-112 students (yourself included), so do not work with more than one other student. Each student should submit their own work individually, submitted as part of hw7c. Include the name and andrew id of your groupmate, if any, at the top of your hw7c.py file. And as always with collaborative work, you must be actively involved in every part of your solution, and you may never simply copy any code from anyone, nor electronically share your code (email, FB, texting, etc) even with your partner.

  1. playTetris() [50 pts] [COLLABORATIVE]

    Write Tetris according to the design given in this step-by-step tutorial using our event-based animation framework (starting with events-example0.py).

    You may not use a different design, even if you think there's a better way to do it (there probably is, but you still have to do it this way). This may seem limiting, but sometimes you are given specs at Polya Step 1 (just indicating the problem to solve), and other times at Polya Step 2 (also indicating the algorithms to use). This is one of those second kind of specs. Your task is to do Polya Step 3, and write the corresponding code, and then using this week's event animation framework.

    Have fun!!!

Hw7s (SOLO)

This portion of hw7 is "hw7s", where the "s" means "SOLO". All the problems on this portion are SOLO, not collaborative. You must work alone, as you have done on all previous hw's this semester.

  1. playDotsAndBoxes [50 pts] [SOLO]
    First, read the Wikipedia page on Dots and Boxes. . Then, write the function playDotsAndBoxes(rows, cols, maxSecondsPerTurn) which will play a human-human Dots and Boxes game on a rows x cols board, but also not allowing more than maxSecondsPerTurn time to elapse on any give turn. If the time elapses, the screen should visibly flash and the player should lose that turn (though not the game). Your user interface can be simple, even quite plain, but it must be functional so two people can use it to play. It must display the board, make clear whose turn it is and where legal moves are, make it easy for players to enter moves, actually make those moves if legal (or reject them if illegal), display who has captured which boxes, alternate turns, display the score, detect game over, and print a suitable game over message. Don't forget about the maximum time per turn, too!

  2. bonus/optional: playBetterSnake [up to 2pts] [SOLO]
    Separately from your version of snake for the problem above, write a new and improved version of Snake, playBetterSnake, included in your splashScreen options, with these additional features, all with a reasonably pleasing user interface:
    1. A score.
    2. A timer.
    3. Multiple snake lives.
    4. A high score file.
    5. A splash screen (at the start of the program), a game over screen, and a help screen.
    6. Walls
      These can be placed randomly, and snakes don't die when they hit walls, they just can't go through walls. So what happens instead? That's up to you. Just do something reasonable and interesting and fun.
    7. Eagles (they eat snakes)
      Eagles start in a random location, but they move towards the snake, and if they get to the snake, they eat it and kill it. Don't make the eagles too aggressive nor too passive, or it won't be fun to play.

  3. bonus/optional: playSokoban [up to 3pts] [SOLO]
    First, read the Wikipedia page on Sokoban. Then, write the function playSokoban() that plays the game. Do not use any images. All drawing must be with graphics primitives (lines, rectangles, ovals, etc). Also, do not use any sound. Besides that, design as you will. The nicer the game, the more points awarded. Have fun!