Bläddra i källkod

add single with bidding mode

master
flavis 6 år sedan
förälder
incheckning
030b3defd0
1 ändrade filer med 17 tillägg och 1 borttagningar
  1. +17
    -1
      src/Skat/Matches.hs

+ 17
- 1
src/Skat/Matches.hs Visa fil

@@ -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


Laddar…
Avbryt
Spara