Fix bug in end of game handling
This commit is contained in:
parent
48f6ab65ab
commit
9fb130c944
1 changed files with 6 additions and 6 deletions
|
@ -78,12 +78,12 @@ answer (Message.Relay {Message.message = Message.Invitation {}}) state = do
|
||||||
return state
|
return state
|
||||||
|
|
||||||
answer (Message.Game {Message.game, Message.logs}) state@(Playing {key, name}) = do
|
answer (Message.Game {Message.game, Message.logs}) state@(Playing {key, name}) = do
|
||||||
if playing game == key
|
case step game of
|
||||||
then do
|
Over -> send Message.Quit >> return (LoggedIn {key, name})
|
||||||
case step game of
|
_ -> do
|
||||||
Over -> send Message.Quit >> return (LoggedIn {key, name})
|
if playing game == key
|
||||||
_ -> send (Message.Play {Message.move = AI.move key game}) >> return state
|
then send (Message.Play {Message.move = AI.move key game}) >> return state
|
||||||
else return state
|
else return state
|
||||||
|
|
||||||
answer (Message.Relay {Message.from, Message.message = Message.LogOut}) (Playing {key, name, against})
|
answer (Message.Relay {Message.from, Message.message = Message.LogOut}) (Playing {key, name, against})
|
||||||
| from == against = send Message.Quit >> return (LoggedIn {key, name})
|
| from == against = send Message.Quit >> return (LoggedIn {key, name})
|
||||||
|
|
Loading…
Reference in a new issue