1 module Main
(main
) where
8 import Control
.Concurrent
9 import Control
.Exception
18 strategy
= simpleStrat
20 singleGame
:: Bool -> Int -> IO Int
21 singleGame verbose n
= do
24 let (res
, brd
) = playGame config gen
(sRun strategy config gen2
)
25 when verbose
$ putStr (show res
++ show brd
)
26 if res
== Won
then return $! (n
+1) else return n
28 summary
:: Int -> IO ()
30 putStrLn ("Won " ++ show i
++ "/" ++ show nGames
++ " games")
36 foldM (\n _
-> singleGame
False n
) 0 (replicate nGames
()) >>= summary
39 finish
<- newEmptyMVar
40 forkOS
(finally
(mainUI strategies
) (putMVar finish
()))