예제 #1
0
        //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();
        }
예제 #2
0
        //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("----------------------------------------------------");
        }