Skip to content

Instantly share code, notes, and snippets.

@internetsadboy
Last active August 29, 2015 14:20
Show Gist options
  • Save internetsadboy/a9bfb8c9778187495944 to your computer and use it in GitHub Desktop.
Save internetsadboy/a9bfb8c9778187495944 to your computer and use it in GitHub Desktop.
boggle write up

Given that a Boggle board's dimensions are N x N, and dice selection is dependent on relative die adjacencies, it seemed practical to construct an undirected graph to represent the board dynamics. I used an adjacency matrix to represent die positions, which was used to construct an adjacency list.

After constructing the adjacency list, testing adjacencies was convenient and predictable.

Implementing the behavior to unselect the most recently selected die seemed to reflect the behavior of a stack, which is what I used to manage the state of die selection.

The remainder of my time was spent mapping the state of the two data structures to the UI, in addition to styling the UI as closely to the spec as possible.

Things I didn't get to, but would want to expand on: caching (convenient for offline), word validation against an English dictionary, and animations that simulate the physical shaking of a Boggle board.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment