add handleskat routine

This commit is contained in:
2020-03-29 16:08:02 +02:00
parent 18aa516905
commit a1e45a0db4
+9 -4
View File
@@ -93,11 +93,16 @@ initGame single bid = do
-- ask if player wants to play hand -- ask if player wants to play hand
noSkat <- askHand (bidder bds single) bid noSkat <- askHand (bidder bds single) bid
-- either return piles or ask for skat cards and modify piles -- either return piles or ask for skat cards and modify piles
ps' <- if noSkat then return ps else do ps' <- if noSkat then return ps else handleSkat (bidder bds single) bid ps
let skat = skatCards ps
skat' <- askSkat (bidder bds single) bid skat
return $ moveToSkat single skat' ps
-- ask for game kind -- ask for game kind
(Colour col _) <- askGame (bidder bds single) bid (Colour col _) <- askGame (bidder bds single) bid
-- construct skat env -- construct skat env
return $ mkSkatEnv ps Nothing col (toPlayers single bds) Hand1 return $ mkSkatEnv ps Nothing col (toPlayers single bds) Hand1
handleSkat :: BD -> Bid -> Piles -> Preperation Piles
handleSkat bd bid ps = do
let skat = skatCards ps
skat' <- askSkat bd bid skat
case moveToSkat (hand bd) skat' ps of
Just correct -> return correct
Nothing -> handleSkat bd bid ps