示例#1
0
 private int NumberOfVisibleAsteroids(Asteroid a)
 {
     return(this.asteroids.Where(b => !b.Equals(a) && this.IsClearLineOfSight(a, b)).Count());
 }
示例#2
0
 private bool IsClearLineOfSight(Asteroid a, Asteroid b)
 {
     return(!this.asteroids.Exists(c => !c.Equals(a) && !c.Equals(b) && IsBetween(a, b, c)));
 }
示例#3
0
 public void Add(Asteroid asteroid)
 {
     this.asteroids.Add(asteroid);
 }