Oscar de Groot Martijn Nijenhof Ales Sturala Christina Manteli.
-
Upload
imogen-shepherd -
Category
Documents
-
view
212 -
download
0
Transcript of Oscar de Groot Martijn Nijenhof Ales Sturala Christina Manteli.
Tetris Specification
Oscar de GrootMartijn Nijenhof
Ales SturalaChristina Manteli
General Specifications (1/2) GameBoard:
A grid of w(columns) x h(rows) ▪ w,h {1,2,3,..}
A collection of cells Cell:
Square shaped Cell state can be either Filled or Empty Each cell has a coordinate c(x,y) on the
GameBoard" c : 0 ≤ c.x ≤ w and 0 ≤ c.y ≤ h
General Specifications (2/2)
Tile: A connected set of Filled cells c1..n(x,y) on
the GameBoard▪ Tile GameBoard▪ 4 Rotation states▪ 2 Shift directions
Only one Tile present at any time Content
All Filled cells except the Tile
Input
Clock tick TryMoveDown RemoveRow
User Input TryRotateLeft TryRotateRight TryShiftLeft TryShiftRight
Rotation Specification (1/2)
A Tile can be rotated Desired: tiles rotate around center of
gravity, point symmetric tiles rotated 180° should be in their original positions.▪ Too complicated.
Each tile must have a specified ‘center of rotation’, which is the cell it rotates around.
Clockwise (TryRotateRight) or counter clockwise (TryRotateLeft)
Rotation Specification (2/2) A Tile can be rotated
RotateLeft: Rotate the Tile 90o counter clockwise around the center of rotation.
TryRotateLeft:▪ RotatedTile = result of the RotateLeft operation▪ If RotatedTile Content = and RotatedTile
GameBoard then RotateLeft(Tile)
Same holds for RotateRight and TryRotateRight
Shift Specification (1/2)
Tile can be shifted into 3 directions: Left, Right, Down ShiftLeft: c coordinate in Tile: c.x = c.x – 1 TryShiftLeft: ▪ ShiftedTile = result of the ShiftLeft operation▪ If ShiftedTile Content =
and ShiftedTile GameBoard then ShiftLeft(Tile)
Same holds for ShiftRight and TryShiftRight
Shift Specification (2/2)
MoveDown: c coordinate in Tile: c.y = c.y - 1
TryMoveDown: MovedTile = result of the MoveDown
operation if MovedTile Content
or MovedTile GameBoard then StuckTile()
Stuck & NewTile Specifications StuckTile:
Content = Content Tile CreateNewTile
CreateNewTile: Create new Tile, where Tile GameBoard
and Tile Content and Tile.MaxYCoordinate = Gameboard.height | Game over
RemoveRows Specification
RemoveRows :: Row where every Row.cell==content: remove all content from Row c in Content where c.y > removed Row
y-coordinate : c.y = c.y – 1
Questions?