From 255971b2f5819150e1323651b79261083c7dec1e Mon Sep 17 00:00:00 2001 From: flavis Date: Wed, 28 Aug 2019 17:24:06 +0200 Subject: [PATCH] publish info on game start --- src/Skat/Matches.hs | 2 +- src/Skat/Operations.hs | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Skat/Matches.hs b/src/Skat/Matches.hs index da30693..c556acc 100644 --- a/src/Skat/Matches.hs +++ b/src/Skat/Matches.hs @@ -22,4 +22,4 @@ singleVsBots mkPlayer = do (PL $ Stupid Team Hand2) (PL $ mkAIEnv Single Hand3 10) env = SkatEnv (distribute cards) Nothing Spades ps - liftIO $ evalStateT (turn Hand1 >>= publishGameResults) env + liftIO $ evalStateT (publishGameStart Hand3 >> turn Hand1 >>= publishGameResults) env diff --git a/src/Skat/Operations.hs b/src/Skat/Operations.hs index 5b1e1e4..d2fbb12 100644 --- a/src/Skat/Operations.hs +++ b/src/Skat/Operations.hs @@ -1,5 +1,6 @@ module Skat.Operations ( - turn, turnGeneric, play, playOpen, publishGameResults + turn, turnGeneric, play, playOpen, publishGameResults, + publishGameStart ) where import Control.Monad.State @@ -93,3 +94,8 @@ publishGameResults :: (Int, Int) -> Skat () publishGameResults res = do pls <- gets players mapM_ (\p -> onGameResults p res) (playersToList pls) + +publishGameStart :: Hand -> Skat () +publishGameStart sglPlayer = do + pls <- gets players + mapM_ (\p -> onGameStart p sglPlayer) (playersToList pls)