The game models
Before creating the REST API project, we start with a library that contains the models to represent the game along with a move of the game. This model will contain the main data part of the Codebreaker Game API service solution, which will be used to read and write to the database (in Chapter 3), while the model also serves as an implementation of the main functionality of the game.
The major types in a simplified version are shown in Figure 2.1. The Game
class implements the IGame
interface. The IGame
interface is used by the Analyzers
package. A game contains a list of moves. A single game move is represented by the Move
class.
Figure 2.1 – The game model
Exploring the game analyzers library
As the focus of this book is not implementing the game rules with .NET, you can use the existing project, Codebreaker.GameAPIs.Analyzers
, or just reference the NuGet package that has been made available on the NuGet server. This library...