Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- type Tile =
- S | Z | L | J | T | O | I
- with
- static member All = [S; Z; L; J; T; O; I]
- static member project tile rotation =
- // Table built from: http://tetris.wikia.com/wiki/SRS
- match tile with
- | O ->
- match rotation with
- | Zero -> [1,0; 2,0; 1,1; 2,1]
- | Ninety -> [1,0; 2,0; 1,1; 2,1]
- | OneEighty -> [1,0; 2,0; 1,1; 2,1]
- | TwoSeventy -> [1,0; 2,0; 1,1; 2,1]
- | J ->
- match rotation with
- | Zero -> [0,0; 0,1; 1,1; 2,1]
- | Ninety -> [1,0; 2,0; 1,1; 1,2]
- | OneEighty -> [0,1; 1,1; 2,1; 2,2]
- | TwoSeventy -> [1,0; 1,1; 0,2; 1,2]
- | L ->
- match rotation with
- | Zero -> [0,1; 1,1; 2,1; 2,0]
- | Ninety -> [1,0; 1,1; 1,2; 2,2]
- | OneEighty -> [0,1; 1,1; 2,1; 0,2]
- | TwoSeventy -> [0,0; 1,0; 1,1; 1,2]
- | I ->
- match rotation with
- | Zero -> [0,1; 1,1; 2,1; 3,1]
- | Ninety -> [2,0; 2,1; 2,2; 2,3]
- | OneEighty -> [0,2; 1,2; 2,2; 3,2]
- | TwoSeventy -> [1,0; 1,1; 1,2; 1,3]
- | S ->
- match rotation with
- | Zero -> [1,0; 2,0; 0,1; 1,1]
- | Ninety -> [1,0; 1,1; 2,1; 2,2]
- | OneEighty -> [1,1; 2,1; 0,2; 1,2]
- | TwoSeventy -> [0,0; 0,1; 1,1; 1,2]
- | Z ->
- match rotation with
- | Zero -> [0,0; 1,0; 1,1; 2,1]
- | Ninety -> [2,0; 1,1; 2,1; 1,2]
- | OneEighty -> [0,1; 1,1; 1,2; 2,2]
- | TwoSeventy -> [1,0; 0,1; 1,1; 0,2]
- | T ->
- match rotation with
- | Zero -> [1,0; 0,1; 1,1; 2,1]
- | Ninety -> [1,0; 1,1; 2,1; 1,2]
- | OneEighty -> [0,1; 1,1; 2,1; 1,2]
- | TwoSeventy -> [1,0; 0,1; 1,1; 1,2]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement