public Player GetWinnerOfGame(Player redPlayer, Player blackPlayer) { Winner w; Board gameState = new Board(); redPlayer.isRed = true; blackPlayer.isRed = false; int turns = 0; do { gameState = GameSim.GetNextMove(gameState, blackPlayer.myBrain, false); gameState = GameSim.GetNextMove(gameState, redPlayer.myBrain, true); w = gameState.GetWinner(); turns++; }while (w == Winner.noWinner && turns < 100); Interlocked.Increment(ref _gamesPlayed); if (w == Winner.noWinner)//after 100 turns, game is considered a draw. Black player "wins" but neither player gets credit for the win/loss { return(blackPlayer); } if (w == Winner.black) { blackPlayer.IncrementWins(); redPlayer.IncrementLosses(); return(blackPlayer); } else { redPlayer.IncrementWins(); blackPlayer.IncrementLosses(); return(redPlayer); } }