samuelpilz / core-catcher

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Detect Game End

samuelpilz opened this issue · comments

The server should detect if the game has ended and send that info to the client.

@fendor Where to include the information that the game has ended?
Possibilities: (please make suggestions)

for sending info to client, it may be sensible to create an own view GameOverView

  • flag in gameState (makes illigal state representable)
  • update Signature of updateState to include Game-Over as possible return type

Are you against different messages for different information?
For example, I was thinking to refactor the whole communication process to something like that:

data ServerMessage 
    = GameView ...
    | GameOver ...
    | InvalidMove ...
    | StartGame ...

data ClientMessage 
    = MoveTo ...
    | WhoseTurnIsIt 
    | Reconnect ...
    | GetView

This is implemented in the branch game-over-state. A pull request will close this issue