瀏覽代碼

add handleskat routine

master
flavis 6 年之前
父節點
當前提交
a1e45a0db4
共有 1 個文件被更改,包括 9 次插入4 次删除
  1. +9
    -4
      src/Skat/Preperation.hs

+ 9
- 4
src/Skat/Preperation.hs 查看文件

@@ -93,11 +93,16 @@ initGame single bid = do
-- ask if player wants to play hand
noSkat <- askHand (bidder bds single) bid
-- either return piles or ask for skat cards and modify piles
ps' <- if noSkat then return ps else do
let skat = skatCards ps
skat' <- askSkat (bidder bds single) bid skat
return $ moveToSkat single skat' ps
ps' <- if noSkat then return ps else handleSkat (bidder bds single) bid ps
-- ask for game kind
(Colour col _) <- askGame (bidder bds single) bid
-- construct skat env
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

Loading…
取消
儲存