add single with bidding mode

This commit is contained in:
2020-03-28 22:48:29 +01:00
parent 1ccce66d4a
commit 030b3defd0
+17 -1
View File
@@ -1,5 +1,5 @@
module Skat.Matches ( module Skat.Matches (
singleVsBots, pvp, pvpWithBidding singleVsBots, pvp, pvpWithBidding, singleWithBidding
) where ) where
import Control.Monad.State import Control.Monad.State
@@ -41,6 +41,22 @@ singleVsBots comm = do
env = SkatEnv (distribute cards) Nothing Spades ps Hand1 env = SkatEnv (distribute cards) Nothing Spades ps Hand1
liftIO $ evalStateT (publishGameStart Hand3 >> turn >>= publishGameResults) env liftIO $ evalStateT (publishGameStart Hand3 >> turn >>= publishGameResults) env
singleWithBidding :: Communicator c => c -> IO ()
singleWithBidding comm = do
cards <- shuffleCards
let ps = distribute cards
h1 = map toCard $ handCards Hand1 ps
bs = Bidders
(BD $ PrepOnline Hand1 comm h1)
(BD $ NoBidder Hand2)
(BD $ NoBidder Hand3)
env = PrepEnv ps bs
maySkatEnv <- liftIO $ runReaderT runPreperation env
case maySkatEnv of
Just skatEnv ->
liftIO $ evalStateT (publishGameStart Hand3 >> turn >>= publishGameResults) skatEnv
Nothing -> putStrLn "No one wanted to play."
pvp :: Communicator c => c -> c -> c -> IO () pvp :: Communicator c => c -> c -> c -> IO ()
pvp comm1 comm2 comm3 = do pvp comm1 comm2 comm3 = do
cards <- shuffleCards cards <- shuffleCards