Remove parameter from Game type, games will be shared publicly with a different type

This commit is contained in:
Tissevert 2019-10-16 10:30:31 +02:00
parent 61eeac8bc6
commit ff1a31a105
4 changed files with 7 additions and 10 deletions

View file

@ -4,8 +4,7 @@ module Hanafuda.KoiKoi (
Action(..)
, Card(..)
, Environment
, Game
, GameBlueprint(..)
, Game(..)
, GameID
, Mode(..)
, Move(..)
@ -22,7 +21,7 @@ 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, GameBlueprint(..), GameID, Mode(..), Move(..), PlayerID
Action(..), Environment, Game(..), GameID, Mode(..), Move(..), PlayerID
, Source(..), Step(..)
)
import qualified Hanafuda.KoiKoi.Round as Round (deal, next)

View file

@ -4,8 +4,7 @@
module Hanafuda.KoiKoi.Game (
Action(..)
, Environment
, Game
, GameBlueprint(..)
, Game(..)
, GameID
, ID
, Mode(..)
@ -40,7 +39,7 @@ type Environment m = (MonadIO m, MonadError String m, MonadWriter [Action] m)
type PlayerID = Player.ID KoiKoi.Score
type GameID = ID Game
data GameBlueprint deckType = Game {
data Game = Game {
mode :: Mode
, scores :: Scores KoiKoi.Score
, month :: Flower
@ -48,13 +47,12 @@ data GameBlueprint deckType = Game {
, playing :: PlayerID
, winning :: PlayerID
, oyake :: PlayerID
, deck :: deckType
, deck :: [Card]
, river :: Pack
, step :: Step
, trick :: [Card]
, rounds :: [(PlayerID, KoiKoi.Score)]
} deriving (Show)
type Game = GameBlueprint [Card]
setPlayer :: Game -> Player KoiKoi.Score -> Game
setPlayer game@(Game {players, playing}) player = game {players = set playing player players}

View file

@ -6,7 +6,7 @@ module Hanafuda.KoiKoi.Round (
import Hanafuda (Flower(Paulownia), cards, shuffle, packOfCards)
import Hanafuda.KoiKoi.Yaku (sumYakus)
import Hanafuda.KoiKoi.Game (Game, GameBlueprint(..), Mode(..), Step(..), end)
import Hanafuda.KoiKoi.Game (Game(..), Mode(..), Step(..), end)
import qualified Hanafuda.Player as Player (deal, get, next, score, yakus)
import Data.Map ((!), insert)
import Control.Monad.IO.Class (MonadIO)

View file

@ -11,7 +11,7 @@ import Hanafuda (Card, Pack, empty, match)
import Hanafuda.Player (Player(..), plays)
import qualified Hanafuda.Player as Player (get, next)
import Hanafuda.KoiKoi.Yaku (meldInto)
import Hanafuda.KoiKoi.Game (Action(..), Environment, Game, GameBlueprint(..), Source(..), Step(..), setPlayer)
import Hanafuda.KoiKoi.Game (Action(..), Environment, Game(..), Source(..), Step(..), setPlayer)
import qualified Hanafuda.KoiKoi.Round as Round (next)
import Control.Monad.Except (MonadError(..))
import Control.Monad.IO.Class (MonadIO)