private static void PlayRandomGames(int numberOfGames) { char startPlayer = 'x'; Random random = new Random(); for (int i = 0; i < numberOfGames; i++) { TTTGame game = new TTTGame(); TTTModel model = new TTTModel(); List <TTTModel> models = new List <TTTModel>(); char player = startPlayer; do { TTTCoord move; do { move = new TTTCoord(random.Next(3), random.Next(3)); } while (!game.CheckMove(player, move)); model = game.PlayMove(player, move); player = game.Turn; models.Add(model); } while (model.Winnner == default && game.MovesLeft > 0); ShowBoard(game.Board); char result = model.Winnner; if (result != default) { Console.WriteLine(result + " wins! " + game.MovesLeft + " moves left."); } else { Console.WriteLine("No one wins."); } Console.WriteLine("\nSaving game to file...\n"); TSVRecorder tsvRecorder = new TSVRecorder(); tsvRecorder.SaveGameToCSV(models.ToArray()); Console.WriteLine($"Game {i + 1} saved."); startPlayer = game.OppositePlayer(player); } }