public static List <pos> SharedNeighbors(this pos p, pos other, bool return_origins_if_adjacent)
        {
            List <pos> result = p.PositionsWithinDistance(1, !return_origins_if_adjacent, true);
            List <pos> others = other.PositionsWithinDistance(1, !return_origins_if_adjacent, true);

            result.RemoveWhere(x => !others.Contains(x));
            return(result);
        }
Exemple #2
0
 public static void AnimateStorm(pos origin, int radius, int num_frames, int num_per_frame, colorchar ch)
 {
     for (int i = 0; i < num_frames; ++i)
     {
         List <pos> cells  = new List <pos>();
         List <pos> nearby = origin.PositionsWithinDistance(radius);
         for (int j = 0; j < num_per_frame; ++j)
         {
             cells.Add(nearby.RemoveRandom());
         }
         Screen.AnimateMapCells(cells, ch);
     }
 }