oscar de groot martijn nijenhof ales sturala christina manteli

11
Tetris Specification Oscar de Groot Martijn Nijenhof Ales Sturala Christina Manteli

Upload: imogen-shepherd

Post on 03-Jan-2016

213 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Oscar de Groot Martijn Nijenhof Ales Sturala Christina Manteli

Tetris Specification

Oscar de GrootMartijn Nijenhof

Ales SturalaChristina Manteli

Page 2: Oscar de Groot Martijn Nijenhof Ales Sturala Christina 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

Page 3: Oscar de Groot Martijn Nijenhof Ales Sturala Christina Manteli

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

Page 4: Oscar de Groot Martijn Nijenhof Ales Sturala Christina Manteli

Input

Clock tick TryMoveDown RemoveRow

User Input TryRotateLeft TryRotateRight TryShiftLeft TryShiftRight

Page 5: Oscar de Groot Martijn Nijenhof Ales Sturala Christina Manteli

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)

Page 6: Oscar de Groot Martijn Nijenhof Ales Sturala Christina Manteli

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

Page 7: Oscar de Groot Martijn Nijenhof Ales Sturala Christina Manteli

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

Page 8: Oscar de Groot Martijn Nijenhof Ales Sturala Christina Manteli

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()

Page 9: Oscar de Groot Martijn Nijenhof Ales Sturala Christina Manteli

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

Page 10: Oscar de Groot Martijn Nijenhof Ales Sturala Christina Manteli

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

Page 11: Oscar de Groot Martijn Nijenhof Ales Sturala Christina Manteli

Questions?