private void AddRectangles() { for (int i = 0; i < 100; i++) { var row = (int)Math.Floor(i / 10d); var column = i - 10 * row; var rectangle = new SnakeRectangle(new Rectangle(), column, row); Rectangles.Add(rectangle); Grid.SetColumn(rectangle.Rectangle, column); Grid.SetRow(rectangle.Rectangle, row); grid.Children.Add(rectangle.Rectangle); } }
private SnakeRectangle GetRectangle(SnakeRectangle rectangle) { return(Rectangles.Where(x => x == rectangle).ToList()[0]); }
public bool SamePosition(SnakeRectangle rectangle) { return(rectangle.Row == Row && rectangle.Column == Column); }