-
Notifications
You must be signed in to change notification settings - Fork 0
Description
- CardDeck
A CardDeck represents a scenario for the game.
All the operations' target should be the CardDeck.
CardDeck controls the whole process, like which role should operate.
A static instance defining all the possible roles. - RoleRegistry
Which specified which roles are selected for this round. - Role
The base class for all roles which should define the interface for all possible roles.
Each role will have its own implementation. - Various inherited roles
Like villager, robber, trouble maker and etc. - History
Which should be recorded in the CardDeck. - Operation
An abstraction of all operations.
Each API represents an operation.
In each API, we only convert the arguments into an instance of Operation and pass it to the CardDeck which maintains the current gaming status.
The function of the role to handle this operation should return a status, OPERATING or END (because a role like a witch has to interact with server twice during her round, see one of the center cards and swap it with another player).
Besides the status, the function should also return, if any, the information shown to the client.
Then, CardDeck will write the message to the corresponding websocket.
After the status of all roles in RoleRegistry hit END, the game ends and start voting.
When all votes received or the time limit is hit, show the final result to the client.