+nonDetGameSimulation :: Int -> Games -> Dice -> Winners -> Winners
+nonDetGameSimulation winThreshold games0 dice winners0
+ -- | trace ((show games0) ++ "; " ++ (show winners0)) False = undefined
+ -- | trace (show winners0) False = undefined
+ | MS.null games0 = winners0
+ | otherwise = nonDetGameSimulation winThreshold games dice winners
+ where games' = nonDetGameStep games0 dice
+ (winGames, games) = MS.partition (finished winThreshold) games'
+ p1Wins = MS.size $ MS.filter (\g -> current g == Player2) winGames
+ p2Wins = MS.size $ MS.filter (\g -> current g == Player1) winGames
+ winners = MS.insertMany Player2 p2Wins $ MS.insertMany Player1 p1Wins winners0
+
+nonDetGameStep :: Games -> Dice -> Games
+nonDetGameStep games dice = MS.foldOccur (nonDetGameStep1 dice) MS.empty games
+-- nonDetGameStep games dice
+ -- | trace ("G0 >" ++ (show games) ++ "-" ++ (show dice)) False = undefined
+ -- | otherwise = MS.foldOccur (nonDetGameStep1 games) MS.empty dice
+
+nonDetGameStep1 :: Dice -> Game -> MS.Occur -> Games -> Games
+nonDetGameStep1 dice game gnum acc = MS.foldOccur (nonDetGameStep2 game gnum) MS.empty dice
+-- nonDetGameStep1 game dice dnum acc
+ -- | trace ("G1 >" ++ (show game) ++ "-" ++ (show dice) ++ ": " ++ (show gnum)) False = undefined
+ -- | otherwise = MS.foldOccur (nonDetGameStep2 dice dnum) acc game
+
+nonDetGameStep2 :: Game -> MS.Occur -> Int -> MS.Occur -> Games -> Games
+nonDetGameStep2 game gnum roll dnum acc = MS.insertMany game' (gnum * dnum) acc
+-- nonDetGameStep2 dice dnum game gnum acc
+ -- | trace ("G2 >" ++ (show game) ++ "-" ++ (show dice) ++ ": " ++ (show gnum) ++ "," ++ (show dnum)) False = undefined
+ -- | otherwise = MS.insertMany game' (gnum * dnum) acc
+ where game' = gameStep game roll