//User wins public void test1() { TicTacToe engine = new TicTacToe(); Console.WriteLine("Test 1"); engine.assignMarks(0); engine.placeMove(0,5); engine.compMove(); engine.placeMove(0, 4); engine.compMove(); engine.board[1, 2] = engine.yourMark; DrawBoard(engine); if (engine.checkEndGame() == 0) { Console.WriteLine("There is no winner yet"); } else if (engine.checkEndGame() == 1) { Console.WriteLine("You win!"); } else if (engine.checkEndGame() == 2) { Console.WriteLine("You lose!"); } else if (engine.checkEndGame() == 3) { Console.WriteLine("Draw!"); } Console.WriteLine(); Console.WriteLine("----------------------------------------------------"); Console.WriteLine(); }
//Test what happens when assignMarks doesn't have a valid turn number public void test5() { TicTacToe engine = new TicTacToe(); Console.WriteLine("Test 5"); Console.WriteLine(); engine.assignMarks(3); if (engine.compMark == (int)marks.none & engine.yourMark == (int)marks.none) Console.WriteLine("ERROR: No marks have been assigned."); Console.WriteLine(); Console.WriteLine("----------------------------------------------------"); Console.WriteLine(); }
//What happens when you try and make a mark on an already made mark public void test6() { TicTacToe engine = new TicTacToe(); Console.WriteLine("Test 6"); engine.assignMarks(1); engine.compMove(); int error = engine.placeMove(0, 5); DrawBoard(engine); if (error == 2) { Console.WriteLine("There is already a mark on square 5"); } }
//draw public void test4() { Console.WriteLine("Test 4"); TicTacToe engine = new TicTacToe(); engine.assignMarks(1); engine.compMove(); engine.placeMove(0, 7); engine.compMove(); engine.placeMove(0, 9); engine.compMove(); engine.placeMove(0, 2); engine.compMove(); engine.placeMove(0, 4); engine.compMove(); DrawBoard(engine); if (engine.checkEndGame() == 0) { Console.WriteLine("There is no winner yet"); } else if (engine.checkEndGame() == 1) { Console.WriteLine("You win!"); } else if (engine.checkEndGame() == 2) { Console.WriteLine("You lose!"); } else if (engine.checkEndGame() == 3) { Console.WriteLine("Draw!"); } Console.WriteLine(); Console.WriteLine("----------------------------------------------------"); }