public override bool Equals(object obj) { ChangePointComposite other = obj as ChangePointComposite; if (other == null) { return(false); } return((this.X == other.X) && (this.Y == other.Y)); }
public override ChangePoint Shoot(Board board, int x, int y) { ChangePoint point = new ChangePointComposite(x, y); for (int i = x - (width / 2); i < x + width - width / 2; i++) { if (board.WithinBounds(i, y)) { point.Add(board.RevealTile(i, y)); } } return(point); }
public override ChangePoint Shoot(Board board, int x, int y) // x y { ChangePoint point = new ChangePointComposite(x, y); for (int i = x; i < x + width; i++) { for (int j = y; j < y + width; j++) { if (board.WithinBounds(i, j)) { point.Add(board.RevealTile(i, j)); } } } return(point); }
public override ChangePoint Shoot(Board board, int x, int y) // x y { ChangePoint point = new ChangePointComposite(x, y); for (int i = x - 2; i < x + 3; i++) { for (int j = y - 2; j < y + 3; j++) { if (board.WithinBounds(i, j) && reveal == true) { point.Add(board.RevealTile(i, j)); } reveal = !reveal; } } return(point); }
public override IEnumerator <ChangePoint> GetEnumerator() { var changePoints = new Queue <ChangePoint>(new[] { this }); while (changePoints.Any()) { ChangePoint point = changePoints.Dequeue(); yield return(point); ChangePointComposite compos = point as ChangePointComposite; if (compos != null) { foreach (ChangePoint p in compos.children) { changePoints.Enqueue(p); } } } }
public override ChangePoint OnReveal(Board board, int x, int y) { ChangePoint point = new ChangePointComposite(x, y); int currIndex = board.GetIndex(x, y); int radius = 2; for (int i = x - radius + 1; i < x + radius; i++) { for (int j = y - radius + 1; j < y + radius; j++) { if (board.WithinBounds(i, j) && currIndex != board.GetIndex(i, j)) { point.Add(board.RevealTile(i, j)); } } } return(point); }