Beispiel #1
0
 public Boolean isValidToBeMoved(Brick b)
 {
     if (bricks.Last() == b)
         return true;
     else
         return false;
 }
Beispiel #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;
 }
Beispiel #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;
 }
Beispiel #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;
        }
Beispiel #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);
                    }
                }
            }
        }
Beispiel #6
0
 public void addBrick(Brick b)
 {
     this.bricks.Add(b);
 }