15-112 Fall 2012 Optional
Quiz C (Not Autograded)
50 Minutes
Read these instructions first!
- This quiz is SOLO.
- This portion is worth 100 pts. There is no written portion this
week.
- No notes, books, web sites (except reading this quiz and accessing
Autolab).
- IDLE hint: python -m idlelib.idle &
- Autolab hint (to submit):
http://autolab.cs.cmu.edu/
- You must submit your quiz8.py file to Autolab before leaving the lab!
You will not have access to this file after you leave the lab!
- To start, download this one file:
optional-quizC.py
(elided).
This contains full implementations of Tetris and Snake. You should
edit and submit that same file with the changes required by the exercises
below.
- Good luck! :-)
- Tetris and Snake Pause [20 pts]
In both Tetris and Snake, make it so that hitting 'p' toggles whether or not
the game is paused. When paused, no timerFired events are processed
(though timerFired may still keep firing), but all keypresses are handled
normally. This makes it easier to debug and test the following two
features...
- Tetris Toggle-Next-Piece [40 pts]
In Tetris, make it so that hitting 't' toggles whether or not to show the
next piece. When toggled on, the next piece should be drawn to the
side of the board, thus allowing for some planning by the player. When
toggled off, the next piece is not drawn to the side of the board.
- Snake Transpose [40 pts]
In Snake,
make it so that hitting 't' transposes the board, exchanging rows and
columns (so the top row becomes the leftmost column and the bottom row
becomes the rightmost column). The snake head's location changes
accordingly, so if it was at (r,c) it instead is at (c,r). However, the
snake's direction is unchanged, so if it was heading left before the
transpose, it is still heading left after the transpose. You may
assume the board is square.
carpe diem - carpe
diem - carpe diem - carpe diem - carpe diem - carpe diem -
carpe diem - carpe diem - carpe diem