예제 #1
0
 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);
     }
 }
예제 #2
0
 private SnakeRectangle GetRectangle(SnakeRectangle rectangle)
 {
     return(Rectangles.Where(x => x == rectangle).ToList()[0]);
 }
예제 #3
0
 public bool SamePosition(SnakeRectangle rectangle)
 {
     return(rectangle.Row == Row && rectangle.Column == Column);
 }