aboutsummaryrefslogtreecommitdiff
path: root/server/lib/Cafp
diff options
context:
space:
mode:
authorJasper Van der Jeugt2020-08-03 16:24:50 +0200
committerJasper Van der Jeugt2020-08-03 16:24:50 +0200
commitf2e1f97490f3f982dc7c5288531254dd5afc4a8d (patch)
tree392ded3d9e8a7506ef93fc74213bb61e763a4153 /server/lib/Cafp
parent97108b628a74861d7e6e44a4987a39e4cee9114a (diff)
Remove cards after submission
Diffstat (limited to 'server/lib/Cafp')
-rw-r--r--server/lib/Cafp/Game.hs8
1 files changed, 6 insertions, 2 deletions
diff --git a/server/lib/Cafp/Game.hs b/server/lib/Cafp/Game.hs
index f0d4d47..8b675e1 100644
--- a/server/lib/Cafp/Game.hs
+++ b/server/lib/Cafp/Game.hs
@@ -23,7 +23,7 @@ import Cafp.Messages
import Control.Lens (Lens', at, iall, imap, ix, orOf,
over, to, (%%=), (%=), (&), (+=),
(.=), (.~), (^.), (^..), (^?),
- _1, _2, _3)
+ _1, _2, _3, (%~))
import Control.Lens.TH (makeLenses, makePrisms)
import Control.Monad (guard)
import Control.Monad.State (State, execState, modify,
@@ -184,8 +184,12 @@ stepGame game = case game ^. gameTable of
pure (proposal, [pid])
(shuffled, seed) = shuffle
(V.fromList $ HMS.toList proposalsMap) (game ^. gameSeed) in
- game & gameSeed .~ seed
+ game
+ & gameSeed .~ seed
& gameTable .~ TableVoting black shuffled HMS.empty
+ & gamePlayers %~ imap (\pid player ->
+ let used = fromMaybe V.empty $ HMS.lookup pid proposals in
+ player & playerHand %~ V.filter (not . (`V.elem` used)))
| otherwise -> game
TableVoting black shuffled votes
-- Everyone has voted.