Skip to content

Instantly share code, notes, and snippets.

@DanLuchi
Created September 30, 2015 12:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DanLuchi/404d84de4f18bc5d1e4c to your computer and use it in GitHub Desktop.
Save DanLuchi/404d84de4f18bc5d1e4c to your computer and use it in GitHub Desktop.
Building Letterpress in React
Step 1: Board
2D array 5x5
value of each entry is a letter
Step 2: create game
initially randomize each letter
this will probably need to get more complicated later (like redo unless vowels > 3 or something)
game board is immutable
Step 3: Game State
another 2D array 5x5
value is either "player 1, player 2 or open"
does it make sense to track locked up tiles here or is that a computed property?
Step 4: Turn
a turn is a request with a list of coordinates in order
possibly letters and their coordinates so that we don't need to look up the letters, but we would need to double check
it is accpeted if the word is in the letterpress dictionary: https://github.com/atebits/Words
We can start with a 1 player game initially
An accepted turn generates a new game state
Step 5: Victory!
The game is over when the game state has no open tiles
Step 6: Score
The score is the number of tiles owned by each player in the game state
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment