private static void RunGame() { Process p = StartAiPlayer(); string line = p.StandardOutput.ReadLine(); DisplayMessageGreen(string.Format("running player: {0}", line)); string config = string.Format("{0} {1} {2} 0 {3}", Game.ROWS, Game.COLUMNS, Game.PIECES_TO_WIN, Game.TIME_LIMIT); DisplayMessageGreen(string.Format("game config: {0}", config)); p.StandardInput.WriteLine(config); Game game = new Game(); GameEvaluator evaluator = new GameEvaluator(); RandomPlayer player2 = new RandomPlayer(); GameStates gameState = GameStates.InProgress; while (gameState == GameStates.InProgress) { // read the move from player line = p.StandardOutput.ReadLine(); DisplayMessageGreen(string.Format("move from player: {0}", line)); // tie the move to the game state and evaluate game.AcceptMove(Game.ME, int.Parse(line.Trim())); gameState = evaluator.EvaluateGame(game); if (gameState != GameStates.InProgress) { HandleEndGame(gameState, p); break; } // get random player's move int move2 = player2.GetMove(game); game.AcceptMove(Game.OPPONENT, move2); gameState = evaluator.EvaluateGame(game); if (gameState != GameStates.InProgress) { HandleEndGame(gameState, p); break; } DisplayMessageGreen(string.Format("sending move: {0}", move2)); p.StandardInput.WriteLine(move2); } p.WaitForExit(); }