summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSusumuKatayama <>2020-01-12 17:46:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2020-01-12 17:46:00 (GMT)
commitfa2ead4bddb2bfd3c6d6d6e22c0e66e397acb683 (patch)
tree0f86aabb7b4344c51459e1f9cbb320359772de0f
parentfe5a426f7a3bd3fea9907b67b34c4b34a8f9eb18 (diff)
version 0.3.0.10.3.0.1
-rwxr-xr-xChangeLog.md4
-rw-r--r--Game/Hanabi.hs4
-rw-r--r--hanabi-dealer.cabal2
3 files changed, 7 insertions, 3 deletions
diff --git a/ChangeLog.md b/ChangeLog.md
index 103d00a..4dd0754 100755
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -1,5 +1,9 @@
# Revision history for hanabi-dealer
+ ## 0.3.0.1 -- 2020-01-12
+
+ * fix bestPossibleRank (and thus isUseless)
+
## 0.3.0.0 -- 2020-01-12
* playable client/server system via WebSocket
diff --git a/Game/Hanabi.hs b/Game/Hanabi.hs
index 1eafb12..cb779d8 100644
--- a/Game/Hanabi.hs
+++ b/Game/Hanabi.hs
@@ -162,8 +162,8 @@ data PublicInfo = PI { gameSpec :: GameSpec
-- | the best achievable rank for each color.
bestPossibleRank :: PublicInfo -> Color -> Number
-bestPossibleRank pub iro = toEnum $ length $ dropWhile (==0) $ zipWith subtract (reverse $ numCards (gameSpec pub) iro)
- (map ((discarded pub IM.!) . cardToInt . C iro) [K5, K4 .. K1])
+bestPossibleRank pub iro = toEnum $ length $ takeWhile (/=0) $ zipWith subtract (numCards (gameSpec pub) iro)
+ (map ((discarded pub IM.!) . cardToInt . C iro) [K1 .. K5])
numCards :: GameSpec -> Color -> [Int]
numCards gs iro = if iro==Multicolor then numMulticolors $ rule gs else [3,2,2,2,1]
-- | isUseless pi card means either the card is already played or it is above the bestPossibleRank.
diff --git a/hanabi-dealer.cabal b/hanabi-dealer.cabal
index cb715af..c315c4f 100644
--- a/hanabi-dealer.cabal
+++ b/hanabi-dealer.cabal
@@ -10,7 +10,7 @@ name: hanabi-dealer
-- PVP summary: +-+------- breaking API changes
-- | | +----- non-breaking API additions
-- | | | +--- code changes with no API change
-version: 0.3.0.0
+version: 0.3.0.1
-- A short (one-line) description of the package.
synopsis: Hanabi card game