Skip to content

Commit

Permalink
Update README to reflect structure changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexpearce committed Jan 4, 2024
1 parent 7e6014b commit 8a90102
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,13 @@ The runtime is under the `TwentyFortyEight.Game` namespace.

- `TwentyFortyEight.Game.Board`: Stores the board size and individual cell values, and encapsulates the business logic of how moves affect the board and whether a board is unsolvable.
- `TwentyFortyEight.Game.Engine`: Operates on the full game state, including the board, number of turns, score, and whether the game has been won or lost.
- `TwentyFortyEight.Game.Manager`: A `GenServer` which acts as a message bus between clients and the engine. It will shut down after several minutes of inactivity, saving the current game state to the database to allow subsequent restarts from where the game was left.
- `TwentyFortyEight.Game.Manager`: A layer between an `Engine` and the database, providing persistence and retrieval of games.
- `TwentyFortyEight.Game.Game`: Persistence schema for storing game state to the database.
- `TwentyFortyEight.Game.ManagerServer`: A `GenServer` which passes messages between a `Manager` it holds and its own clients. It will shut down after several minutes of inactivity, triggering database persistence to allow subsequent restarts to pick up from where the game was left.

Phoenix components are under the `TwentyFortyEightWeb` namespace.

- `TwentyFortyEightWeb.GameController`: Presents the new-game form and handles its submission.
- `TwentyFortyEightWeb.GameLive`: A LiveView which creates or connects to `Manager` instances. It requests game state from the manager to display it, forwards key presses to the manager, and uses a PubSub topic for synchronising updates between players.

Finally, there's a bunch of Phoenix boilerplate I haven't tidied up!
Finally, there's a bunch of Phoenix boilerplate I haven't tidied up!

0 comments on commit 8a90102

Please sign in to comment.