예제 #1
0
 protected override void Apply(Point coords, Grid grid)
 {
     if (0 <= coords.X && coords.X < grid.Width && 0 <= coords.Y && coords.Y < grid.Height)
     {
         if (grid.Dots[coords.X, coords.Y] >= 0)
         {
             return;
         }
         if (grid.Bridges[coords.X, coords.Y])
         {
             grid.Bridges[coords.X, coords.Y] = false;
             return;
         }
         if (Grid.Directions.All(d => !grid.IsBridge(coords, d) && !grid.IsWall(coords, d)))
         {
             grid.Bridges[coords.X, coords.Y] = true;
         }
     }
 }
예제 #2
0
 private bool IsBridge(Point p, Point d)
 {
     return(Grid.IsBridge(p, d));
 }