public void WhereToGo_Final_5() { TikTakToeAI.Program program = new TikTakToeAI.Program(); List <string> board = new List <string>(); List <int> whichToCheck = new List <int>(); board = settingBoardList(board); for (int i = 0; i < 9; i++) { board.Add(" "); } board[0] = "X"; board[1] = " "; board[2] = " "; board[3] = " "; board[4] = " "; board[5] = " "; board[6] = " "; board[7] = " "; board[8] = " "; int result = program.whereToGo(board); Assert.AreEqual(result, 4); }
public void startGameVsPc() { boardObject.fillingBoardWithEmptyValues(); Player player1 = new Player("X"); Player player2 = new Player("O"); int enteringValue = 0; while (gameNotEnded) { boardObject.showBoard(); Console.WriteLine("Player 1 turn"); do { enteringValue = boardObject.fillOne(player1.returnPlayerSymbol(), Int16.Parse(turn(player1))); } while (enteringValue == 0); boardObject.showBoard(); if (boardObject.checkingIfGameIsEnded() == 1) { Console.WriteLine("Player 1 won"); break; } if (boardObject.checkingHowMuchEmptyWindows() == 0) { Console.WriteLine("Draw"); break; } Console.Clear(); boardObject.showBoard(); Console.WriteLine("PC turn"); TikTakToeAI.Program pcObject = new TikTakToeAI.Program(); int whereToGoValue = pcObject.whereToGo(boardObject.boardList, player2.returnPlayerSymbol(), player1.returnPlayerSymbol()); boardObject.fillOnePC(player2.returnPlayerSymbol(), whereToGoValue); boardObject.showBoard(); boardObject.checkingIfGameIsEnded(); if (boardObject.checkingIfGameIsEnded() == 1) { Console.WriteLine("PC won"); break; } if (boardObject.checkingHowMuchEmptyWindows() == 0) { Console.WriteLine("Draw"); break; } Console.Clear(); } }
public void WhereToGo_3() { TikTakToeAI.Program program = new TikTakToeAI.Program(); List <string> board = new List <string>(); for (int i = 0; i < 9; i++) { board.Add(" "); } board[0] = "X"; board[1] = "X"; board[2] = " "; int result = program.whereToGo(board); Assert.AreEqual(result, 2); }