예제 #1
0
        static void Main(string[] args)
        {
            if (args.Length == 1 && args[0] == "g")
            {
                Board.GenerateDuplets();
                Board.GenerateTriplets();
                return;
            }

            DateTime start = DateTime.Now;

            Board gameBoard = new Board();
            bool drawnGame = false;
            bool wonGame = false;
            char winner = 'c';
            while (true)
            {
                MakeAMove(Side1, gameBoard);
                CheckWinLoseDraw(gameBoard, ref drawnGame, ref wonGame, ref winner);
                if (wonGame || drawnGame)
                {
                    break;
                }

                MakeAMove(Side2, gameBoard);
                CheckWinLoseDraw(gameBoard, ref drawnGame, ref wonGame, ref winner);
                if (wonGame || drawnGame)
                {
                    break;
                }
            }

            Console.WriteLine("Run time: " + (DateTime.Now - start));

            if (drawnGame)
            {
                Console.WriteLine("Drawn game!");
                Console.WriteLine(gameBoard.ToString());
                Console.ReadLine();
                return;
            }

            if (wonGame)
            {
                Console.WriteLine(winner + " has won!");
                Console.WriteLine(gameBoard.ToString());
                Console.ReadLine();
                return;
            }
            Console.WriteLine("Impossible");
        }
예제 #2
0
 public void ToStringTest()
 {
     Board target = new Board(); // TODO: Initialize to an appropriate value
     string expected = @". . .
     . . .
     . . .
     . . .
     "; // TODO: Initialize to an appropriate value
     string actual;
     actual = target.ToString();
     Assert.IsTrue(expected == actual);
     //Assert.Inconclusive("Verify the correctness of this test method.");
 }