public bool GetNextMove(GameBoard.Player player, out GameHistory.GameMove mv, out string prompt) { prompt = String.Empty; //keep trying until the user quits or enters a valid input //while (true) //{ //prompt user for imnput ConsoleWriteLine("Enter row and column for your move: row , column. \nor enter 'Q' to quit the game: ", false); string input = Console.ReadLine(); //if player is quiting throw quit exception if (input.Trim().ToUpper() == "Q") { throw new QuitGameException("Quiting TicTacToe Game"); } //split inputs into row and col numbers var inputs = input.Split(new char[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries); int digit = -1; List <int> move = new List <int>(); foreach (string i in inputs) { if (Int32.TryParse(i, out digit)) { move.Add(digit); } } //check move input for valid input if (move.Count == 2) { if (currentBoard.ValidMove(move[0] - 1, move[1] - 1, player == GameBoard.Player.O ? GameBoard.Move.O : GameBoard.Move.X)) { var row = move[0] - 1; var col = move[1] - 1; mv = new GameHistory.GameMove(MoveFromPlayer(player), GameBoard.IndexFromRowCol(row, col)); return(true); } prompt = "\nInvalid Input read. Must enter an integer between 1 and 3 a comma and an integer between 1 and 3\n"; } else if (move.Count > 2) { prompt = "\nToo many inputs entered" + "\nUser input was " + input + "\nMust enter an integer between 0 and 2 a comma and an integer between 0 and 2\n"; } else if (move.Count < 2) { prompt = "\nToo few inputs entered" + "\nUser input was " + input + "Must enter an integer between 0 and 2 a comma and an integer between 0 and 2\n"; } mv = null; return(false); //} }