|
|
|
@@ -1,11 +1,11 @@ |
|
|
|
module Skat.Matches ( |
|
|
|
singleVsBots, pvp, singleWithBidding, Match(..), Unfinished(..), continue, |
|
|
|
Table(..) |
|
|
|
Table(..), twoWithBidding, H(..), randomPositions |
|
|
|
) where |
|
|
|
|
|
|
|
import Control.Monad.State |
|
|
|
import Control.Monad.Reader |
|
|
|
import System.Random (mkStdGen) |
|
|
|
import System.Random (mkStdGen, newStdGen) |
|
|
|
|
|
|
|
import Skat |
|
|
|
import Skat.Operations |
|
|
|
@@ -14,6 +14,7 @@ import Skat.Pile |
|
|
|
import Skat.Card |
|
|
|
import Skat.Preperation |
|
|
|
import Skat.Bidding |
|
|
|
import Skat.Utils (shuffle) |
|
|
|
|
|
|
|
import Skat.AI.Rulebased |
|
|
|
import Skat.AI.Online |
|
|
|
@@ -122,6 +123,26 @@ singleWithBidding comm = do |
|
|
|
env = makePrep ps bs |
|
|
|
void $ match env |
|
|
|
|
|
|
|
--- helper object for twoWithBidding |
|
|
|
data H = P1 | P2 | AI |
|
|
|
|
|
|
|
randomPositions :: IO [H] |
|
|
|
randomPositions = do |
|
|
|
gen <- newStdGen |
|
|
|
return $ shuffle gen [P1, P2, AI] |
|
|
|
|
|
|
|
twoWithBidding :: Communicator c => [H] -> c -> c -> IO () |
|
|
|
twoWithBidding positions comm1 comm2 = do |
|
|
|
cards <- shuffleCards |
|
|
|
let bds = zipWith mkBidder [Hand1, Hand2, Hand3] positions |
|
|
|
ps = distribute cards |
|
|
|
mkBidder hand P1 = BD $ PrepOnline hand comm1 (map toCard $ handCards hand ps) |
|
|
|
mkBidder hand P2 = BD $ PrepOnline hand comm2 (map toCard $ handCards hand ps) |
|
|
|
mkBidder hand AI = BD $ NoBidder hand |
|
|
|
bs = Bidders (bds !! 0) (bds !! 1) (bds !! 2) |
|
|
|
env = makePrep ps bs |
|
|
|
void $ match env |
|
|
|
|
|
|
|
pvp :: Communicator c => c -> c -> c -> IO Table |
|
|
|
pvp comm1 comm2 comm3 = do |
|
|
|
cards <- shuffleCards |
|
|
|
|