예제 #1
0
        public GameBoard()
        {
            board = new GameSquare[8, 7];

            // Create non-empty game squares

            // Safe squares...
            board[4, 1] = new SafeSquare(4, 1);
            board[6, 3] = new SafeSquare(6, 3);

            // Hostile squares...
            board[6, 0] = new HostileSquare(6, 0);
            board[2, 4] = new HostileSquare(2, 4);
            board[7, 6] = new HostileSquare(7, 6);

            // Warp squares...
            // Warp gate A
            board[5, 0] = new WarpSquare(5, 0);
            board[1, 3] = new WarpSquare(1, 3);
            ((WarpSquare)board[5, 0]).TargetSquare = board[1, 3];
            ((WarpSquare)board[1, 3]).TargetSquare = board[5, 0];
            ((WarpSquare)board[5, 0]).WarpColor    = Brushes.Blue;
            ((WarpSquare)board[1, 3]).WarpColor    = Brushes.Blue;

            // Warp gate B
            board[1, 1] = new WarpSquare(1, 1);
            board[7, 5] = new WarpSquare(7, 5);
            ((WarpSquare)board[1, 1]).TargetSquare = board[7, 5];
            ((WarpSquare)board[7, 5]).TargetSquare = board[1, 1];
            ((WarpSquare)board[1, 1]).WarpColor    = Brushes.Yellow;
            ((WarpSquare)board[7, 5]).WarpColor    = Brushes.Yellow;

            // Warp gate C
            board[2, 0] = new WarpSquare(2, 0);
            board[4, 6] = new WarpSquare(4, 6);
            ((WarpSquare)board[2, 0]).TargetSquare = board[4, 6];
            ((WarpSquare)board[4, 6]).TargetSquare = board[2, 0];
            ((WarpSquare)board[2, 0]).WarpColor    = Brushes.Violet;
            ((WarpSquare)board[4, 6]).WarpColor    = Brushes.Violet;

            // Everything else is empty
            for (int i = 0; i < ColumnCount; i++)
            {
                for (int j = 0; j < RowCount; j++)
                {
                    if (board[i, j] == null)
                    {
                        board[i, j] = new EmptySquare(i, j);
                    }
                }
            }

            // Mark winning location
            board[7, 0].IsWinningLoc = true;

            // Set state
            ResetState();
        }
예제 #2
0
        public GameBoard()
        {
            board = new GameSquare[8, 7];

            // Create non-empty game squares

            // Safe squares...
            board[4, 1] = new SafeSquare(4, 1);
            board[6, 3] = new SafeSquare(6, 3);

            // Hostile squares...
            board[6, 0] = new HostileSquare(6, 0);
            board[2, 4] = new HostileSquare(2, 4);
            board[7, 6] = new HostileSquare(7, 6);

            // Warp squares...
            // Warp gate A
            board[5, 0] = new WarpSquare(5, 0);
            board[1, 3] = new WarpSquare(1, 3);
            ((WarpSquare)board[5, 0]).TargetSquare = board[1, 3];
            ((WarpSquare)board[1, 3]).TargetSquare = board[5, 0];
            ((WarpSquare)board[5, 0]).WarpColor = Brushes.Blue;
            ((WarpSquare)board[1, 3]).WarpColor = Brushes.Blue;

            // Warp gate B
            board[1, 1] = new WarpSquare(1, 1);
            board[7, 5] = new WarpSquare(7, 5);
            ((WarpSquare)board[1, 1]).TargetSquare = board[7, 5];
            ((WarpSquare)board[7, 5]).TargetSquare = board[1, 1];
            ((WarpSquare)board[1, 1]).WarpColor = Brushes.Yellow;
            ((WarpSquare)board[7, 5]).WarpColor = Brushes.Yellow;

            // Warp gate C
            board[2, 0] = new WarpSquare(2, 0);
            board[4, 6] = new WarpSquare(4, 6);
            ((WarpSquare)board[2, 0]).TargetSquare = board[4, 6];
            ((WarpSquare)board[4, 6]).TargetSquare = board[2, 0];
            ((WarpSquare)board[2, 0]).WarpColor = Brushes.Violet;
            ((WarpSquare)board[4, 6]).WarpColor = Brushes.Violet;

            // Everything else is empty
            for (int i = 0; i < ColumnCount; i++)
            {
                for (int j = 0; j < RowCount; j++)
                {
                    if (board[i, j] == null)
                    {
                        board[i, j] = new EmptySquare(i, j);
                    }
                }
            }

            // Mark winning location
            board[7, 0].IsWinningLoc = true;

            // Set state
            ResetState();
        }