Преглед изворни кода

add single with bidding mode

master
flavis пре 6 година
родитељ
комит
030b3defd0
1 измењених фајлова са 17 додато и 1 уклоњено
  1. +17
    -1
      src/Skat/Matches.hs

+ 17
- 1
src/Skat/Matches.hs Прегледај датотеку

@@ -1,5 +1,5 @@
module Skat.Matches (
singleVsBots, pvp, pvpWithBidding
singleVsBots, pvp, pvpWithBidding, singleWithBidding
) where

import Control.Monad.State
@@ -41,6 +41,22 @@ singleVsBots comm = do
env = SkatEnv (distribute cards) Nothing Spades ps Hand1
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 comm1 comm2 comm3 = do
cards <- shuffleCards


Loading…
Откажи
Сачувај