Follow «Coordinates» change in protocol
This commit is contained in:
parent
76c27fa4b4
commit
ff9194d416
1 changed files with 6 additions and 2 deletions
|
@ -14,10 +14,11 @@ import Hanafuda (
|
|||
)
|
||||
import Hanafuda.KoiKoi (Move(..), PlayerID, Step(..))
|
||||
import Hanafuda.Message (PublicGame(..), PublicState(..), PublicPlayer)
|
||||
import qualified Hanafuda.Message as Message (Coordinates(..))
|
||||
|
||||
move :: PlayerID -> PublicGame -> Move
|
||||
|
||||
move me (PublicGame {playerHand, public = PublicState {step = ToPlay, month, players, river}}) =
|
||||
move me (PublicGame {playerHand, public = PublicState {coordinates, step = ToPlay, players, river}}) =
|
||||
case getAvailableCards hand (cardsOfPack river) of
|
||||
[] -> Play $ worstFor month opponent hand
|
||||
available ->
|
||||
|
@ -25,11 +26,14 @@ move me (PublicGame {playerHand, public = PublicState {step = ToPlay, month, pla
|
|||
let matchingCards = cardsOfPack . sameMonth riverCard $ playerHand in
|
||||
capture (bestFor month (players ! me) matchingCards) riverCard river
|
||||
where
|
||||
month = Message.month $ coordinates
|
||||
hand = cardsOfPack playerHand
|
||||
opponent = snd . findMin $ delete me players
|
||||
|
||||
move me (PublicGame {public = PublicState {step = Turned card, month, players, river}}) =
|
||||
move me (PublicGame {public = PublicState {coordinates, step = Turned card, players, river}}) =
|
||||
Choose . bestFor month (players ! me) . cardsOfPack $ sameMonth card river
|
||||
where
|
||||
month = Message.month $ coordinates
|
||||
|
||||
move _ (PublicGame {playerHand, public = PublicState {step = Scored}}) =
|
||||
KoiKoi $ playerHand /= empty
|
||||
|
|
Loading…
Reference in a new issue