Finally export the useful Player type instanciated for KoiKoi games since that the only ones we support so far
This commit is contained in:
parent
ff1a31a105
commit
d2918c5256
2 changed files with 18 additions and 8 deletions
|
@ -8,8 +8,11 @@ module Hanafuda.KoiKoi (
|
|||
, GameID
|
||||
, Mode(..)
|
||||
, Move(..)
|
||||
, Player
|
||||
, PlayerID
|
||||
, Players
|
||||
, Score
|
||||
, Scores
|
||||
, Source(..)
|
||||
, Step(..)
|
||||
, Yaku(..)
|
||||
|
@ -21,8 +24,8 @@ import Hanafuda (Card(..), Flower(Pine), contains, flower, match, remove)
|
|||
import qualified Hanafuda.Player as Player (players, random, scores)
|
||||
import Hanafuda.KoiKoi.Yaku (Yaku(..), Score)
|
||||
import Hanafuda.KoiKoi.Game (
|
||||
Action(..), Environment, Game(..), GameID, Mode(..), Move(..), PlayerID
|
||||
, Source(..), Step(..)
|
||||
Action(..), Environment, Game(..), GameID, Mode(..), Move(..), Player
|
||||
, PlayerID, Players, Scores, Source(..), Step(..)
|
||||
)
|
||||
import qualified Hanafuda.KoiKoi.Round as Round (deal, next)
|
||||
import qualified Hanafuda.KoiKoi.Turn as Turn (catch, end, next)
|
||||
|
|
|
@ -9,7 +9,10 @@ module Hanafuda.KoiKoi.Game (
|
|||
, ID
|
||||
, Mode(..)
|
||||
, Move(..)
|
||||
, Player
|
||||
, PlayerID
|
||||
, Players
|
||||
, Scores
|
||||
, Source(..)
|
||||
, Step(..)
|
||||
, end
|
||||
|
@ -22,8 +25,7 @@ import Control.Monad.Writer (MonadWriter)
|
|||
import Hanafuda (Card, Flower, Pack)
|
||||
import Hanafuda.ID (ID)
|
||||
import qualified Hanafuda.KoiKoi.Yaku as KoiKoi (Score)
|
||||
import Hanafuda.Player (Players, Player, Scores, set)
|
||||
import qualified Hanafuda.Player as Player (ID)
|
||||
import qualified Hanafuda.Player as Player (ID, Players, Player, Scores, set)
|
||||
|
||||
data Mode = FirstAt Int | WholeYear deriving (Show)
|
||||
data Move = Play Card | Capture (Card, Card) | Choose Card | KoiKoi Bool
|
||||
|
@ -36,14 +38,17 @@ data Action = Action {
|
|||
} deriving (Show)
|
||||
|
||||
type Environment m = (MonadIO m, MonadError String m, MonadWriter [Action] m)
|
||||
type Player = Player.Player KoiKoi.Score
|
||||
type PlayerID = Player.ID KoiKoi.Score
|
||||
type Players = Player.Players KoiKoi.Score
|
||||
type Scores = Player.Scores KoiKoi.Score
|
||||
type GameID = ID Game
|
||||
|
||||
data Game = Game {
|
||||
mode :: Mode
|
||||
, scores :: Scores KoiKoi.Score
|
||||
, scores :: Scores
|
||||
, month :: Flower
|
||||
, players :: Players KoiKoi.Score
|
||||
, players :: Players
|
||||
, playing :: PlayerID
|
||||
, winning :: PlayerID
|
||||
, oyake :: PlayerID
|
||||
|
@ -54,8 +59,10 @@ data Game = Game {
|
|||
, rounds :: [(PlayerID, KoiKoi.Score)]
|
||||
} deriving (Show)
|
||||
|
||||
setPlayer :: Game -> Player KoiKoi.Score -> Game
|
||||
setPlayer game@(Game {players, playing}) player = game {players = set playing player players}
|
||||
setPlayer :: Game -> Player -> Game
|
||||
setPlayer game@(Game {players, playing}) player = game {
|
||||
players = Player.set playing player players
|
||||
}
|
||||
|
||||
end :: Monad m => Game -> m Game
|
||||
end game = return $ game {step = Over}
|
||||
|
|
Loading…
Reference in a new issue