Пример #1
0
        static void Main()
        {
            //Application.EnableVisualStyles();
            //Application.SetCompatibleTextRenderingDefault(false);
            //Application.Run(new Form1());

            IBoard         b  = new ThreeDBoard();
            ResultAnalyser ra = new ResultAnalyser(b);

            Console.WriteLine("Enter name of 1st player");
            string player1 = Console.ReadLine();

            Console.WriteLine("Enter name of 2st player");
            String player2 = Console.ReadLine();

            Player p1 = new Player(player1, Mark.X);
            Player p2 = new Player(player2, Mark.O);

            Player[] p = { p1, p2 };

            Game game = new Game(b, p, ra);

            Console.WriteLine("Enter the Cell no from 1 to 9");

            for (int i = 0; i < 9; i++)
            {
                int a = 0;
                //int.Parse(Console.ReadLine());
                Result result = game.play(a - 1);
                displayResult[a - 1] = b.getCell(a - 1).ToString();
                display();
                if (result == Result.WIN)
                {
                    Console.WriteLine(game.getCurrentPlayer() + "  " + result);
                    break;
                }
                Console.WriteLine(result);
            }
            Console.ReadKey();
        }
 public ResultAnalyser(IBoard board)
 {
     this.board = (ThreeDBoard)board;
     this.cell  = board.getAllCell();
 }