private static double CalcWreakRank(GameItem w, GameItem myReaper, IEnumerable <GameItem> units) { var dist = w.DistanceTo(myReaper); var otherReapers = units.Where(x => x.player != 0 && x.IsReaper()); var otherDistMin = otherReapers.Min(x => w.DistanceTo(x)); var tankers = units.Where(x => x.IsTanker()); return(dist * -1 + (dist < w.radius ? 300 : 0) + (otherDistMin > dist && dist > w.radius ? 2000 * (w.extra - 1) : 0) + (w.extra > 1 ? 300 : 0) + (tankers.Any(t => t.DistanceTo(w) < t.radius) ? -300 : 0) + 0); }