Skip to content

Backend module list #2

@Andimeo

Description

@Andimeo
  1. 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.
  2. RoleRegistry
    Which specified which roles are selected for this round.
  3. Role
    The base class for all roles which should define the interface for all possible roles.
    Each role will have its own implementation.
  4. Various inherited roles
    Like villager, robber, trouble maker and etc.
  5. History
    Which should be recorded in the CardDeck.
  6. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions