Example #1
0
        public GameField(MainWindow mainWindow)
        {
            this.mainWindow = mainWindow;
            this.formGrid   = mainWindow.grid;
            CheckerFactory factory = CheckerFactory.GetInstance();

            grid = new IChecker[9][];
            for (int i = 1; i <= 8; i++)
            {
                grid[i] = new IChecker[9];
            }

            stepsHistory = new List <string>();
            Turn         = Lib.PlayersSide.WHITE; // whites start

            for (int i = 1; i <= 8; i++)          //генерация шашек
            {
                if (i % 2 == 0)
                {
                    factory.CreateWhite(new Coord(7, i), this);
                    factory.CreateBlack(new Coord(3, i), this);
                    factory.CreateBlack(new Coord(1, i), this);
                }
                else
                {
                    factory.CreateBlack(new Coord(2, i), this);
                    factory.CreateWhite(new Coord(6, i), this);
                    factory.CreateWhite(new Coord(8, i), this);
                }
            }

            //factory.CreateBlack(new Coord(5, 2), this);
            //factory.CreateBlack(new Coord(4, 3), this);
            //IChecker checker = factory.CreateWhite(new Coord(2, 3), this);
            //checker.BecomeKing();
        }