Unify Points type + export it with Score and Step types in module KoiKoi

This commit is contained in:
Sasha 2018-05-12 11:17:37 +02:00
parent 0c58e94c6f
commit 8ad996914d
4 changed files with 11 additions and 2 deletions

View file

@ -1,5 +1,10 @@
# Revision history for hanafuda # Revision history for hanafuda
## 0.2.1.0 -- 2018-03-16
* Export some more types needed to export the game's state
* Unify the different types aliases for Points used in Player and Yaku
## 0.2.0.0 -- 2018-03-16 ## 0.2.0.0 -- 2018-03-16
* Restructured the project to expose only the cards, a parametric type for players, and a module to play KoiKoi * Restructured the project to expose only the cards, a parametric type for players, and a module to play KoiKoi

View file

@ -2,7 +2,7 @@
-- documentation, see http://haskell.org/cabal/users-guide/ -- documentation, see http://haskell.org/cabal/users-guide/
name: hanafuda name: hanafuda
version: 0.2.0.0 version: 0.2.1.0
synopsis: A game of Hanafuda (a family of japanese card games) synopsis: A game of Hanafuda (a family of japanese card games)
description: This is a library to represent the cards and the players description: This is a library to represent the cards and the players
of games in this family. It also implements one such game of games in this family. It also implements one such game

View file

@ -6,12 +6,16 @@ module Hanafuda.KoiKoi (
, Move(..) , Move(..)
, On(..) , On(..)
, Over(..) , Over(..)
, Score
, Step(..)
, Yaku(..)
, new , new
, play , play
) where ) where
import Hanafuda (Card(..), Flower(Pine), contains, flower, match, remove) import Hanafuda (Card(..), Flower(Pine), contains, flower, match, remove)
import qualified Hanafuda.Player as Player (deal) import qualified Hanafuda.Player as Player (deal)
import Hanafuda.KoiKoi.Yaku (Yaku(..), Score)
import Hanafuda.KoiKoi.Game (Game(..), Mode(..), Move(..), On(..), Over(..), Step(..), raise) import Hanafuda.KoiKoi.Game (Game(..), Mode(..), Move(..), On(..), Over(..), Step(..), raise)
import qualified Hanafuda.KoiKoi.Round as Round (deal, next) import qualified Hanafuda.KoiKoi.Round as Round (deal, next)
import qualified Hanafuda.KoiKoi.Turn as Turn (catch, end, next) import qualified Hanafuda.KoiKoi.Turn as Turn (catch, end, next)

View file

@ -2,6 +2,7 @@
module Hanafuda.KoiKoi.Yaku where module Hanafuda.KoiKoi.Yaku where
import Hanafuda (Card(..), Monthly, Pack, add, contains, intersection, packOfCards, size) import Hanafuda (Card(..), Monthly, Pack, add, contains, intersection, packOfCards, size)
import Hanafuda.Player (Points)
import qualified Data.Map as M (Map, empty, insert, unionWith, (!)) import qualified Data.Map as M (Map, empty, insert, unionWith, (!))
import qualified Data.Set as S (Set, empty, singleton, union) import qualified Data.Set as S (Set, empty, singleton, union)
import Control.Monad.Reader (reader) import Control.Monad.Reader (reader)
@ -19,7 +20,6 @@ data Yaku =
| TsukiFuda | TsukiFuda
deriving (Eq, Ord, Show) deriving (Eq, Ord, Show)
type YakuRater = Pack -> Maybe Points type YakuRater = Pack -> Maybe Points
type Points = Int
type Score = M.Map Yaku Points type Score = M.Map Yaku Points
data YakuFinder = YakuFinder { data YakuFinder = YakuFinder {