-
Notifications
You must be signed in to change notification settings - Fork 3
Domain Model
The Quoridor board game is composed of Board, User, and Game. The Game is the parent class for all classes directly related to the current game being played. Once a game is done, a new Game class can be initialised to completely reset the game. The Game class also keeps track of the current turn to determine which player goes next.
The Board class is simply a container class for all the Tiles. The Board and Tiles remain static throughout games and should only be initialized once.
The Game class consists of Pawn, Player and Wall. The Move class is a generalization of PawnMove and WallMove. When a player moves a wall/pawn, a new Move instance is created and the Wall/Pawn class is updated, and the wall/pawn is associated with this specific player. The Wall has two associations with the Player: one association for the walls in player's stock, and another association for the walls on the board moved by the players.
The Wall class is associated to the Wall move class as its position is entirely determined by the the move that played it, whereas the Pawn is not associated since a Pawn location changes with every PawnMove. A Wall is either part of the walls in stock or is played on the board, if the wall contains an association to Wall move then it is the latter.
The Tile class is used to store all the information about the tile positions. Pawn-to-Tile and Move-to-Tile are directional associations because Tile does not need to know anything about the Move and Pawn class.
The Player-to-User is a directional association. The player class is directly interacting with gameplay elements. It is also useful for the replay system as a user does not necessarily need a player to view a replay. The User class can have many users in the system.