示例#1
0
 public Boolean isValidToBeMoved(Brick b)
 {
     if (bricks.Last() == b)
         return true;
     else
         return false;
 }
示例#2
0
 public bool removeBrickFromParent(Brick b)
 {
     foreach (Stack s in game.getStacks()) {
         if (s.getBricks().Contains(b)) {
             s.getBricks().Remove(b);
             return true;
         }
     }
     return false;
 }
示例#3
0
 public Boolean isValidMove(Brick b, int currentPos)
 {
     // stack can only be next to the current position
     if (currentPos + 1 == position || currentPos - 1 == position) {
         if (bricks.Count == 0)
             return true;
         else if (bricks.Last().size > b.size)
             return true;
     }
     return false;
 }
示例#4
0
        public BrickView(Brick brick, GamePanelCallback callback, StackView parent, int width)
        {
            InitializeComponent();
            this.callback = callback;
            this.parent = parent;

            this.brick = brick;
            this.Width = width;

            lbSize.Text = brick.size.ToString();
            this.BackColor = brick.color;
        }
示例#5
0
        private void setupGame()
        {
            stacks = new List<Stack>();
            int level = (int)difficulty;
            for (int i = 1; i <= level; i++) {

                Stack stack = new Stack(i);
                this.stacks.Add(stack);

                // create bricks
                if (i == 1) {
                    for (int b = level; b >= 1; b--) {
                        Brick brick = new Brick(b, getRandomColor());
                        stack.addBrick(brick);
                    }
                }
            }
        }
示例#6
0
 public void addBrick(Brick b)
 {
     this.bricks.Add(b);
 }