public Boolean isValidToBeMoved(Brick b) { if (bricks.Last() == b) return true; else return false; }
public bool removeBrickFromParent(Brick b) { foreach (Stack s in game.getStacks()) { if (s.getBricks().Contains(b)) { s.getBricks().Remove(b); return true; } } return false; }
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; }
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; }
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); } } } }
public void addBrick(Brick b) { this.bricks.Add(b); }