Skip to content

Instantly share code, notes, and snippets.

@chribben
Created August 13, 2013 21:18
Show Gist options
  • Save chribben/6225801 to your computer and use it in GitHub Desktop.
Save chribben/6225801 to your computer and use it in GitHub Desktop.
Tetris Brick Generator
import Random
data Brick = Line | LeftSquiggle | RightSquiggle | LeftStick | RightStick | Square
rand a = Random.range 0 6 (constant a)
brick n = if | n == 0 -> Line
| n == 2 -> LeftSquiggle
| n == 3 -> RightSquiggle
| n == 4 -> RightStick
| n == 5 -> LeftStick
| otherwise -> Square
main = asText <~ (brick <~ (rand 1))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment