private static List <Field> GetShotsInTheAir() { StartFunction("GetShotsInTheAir"); List <Field> result = new List <Field>(); foreach (var shot in Gameboard.GetCannonballs()) { result.Add(Gameboard.Fields[shot.Col, shot.Row]); } StopFunction("GetShotsInTheAir", Program.LogLevel.TRACE); return(result); }
private static IEnumerable <Field> getBlockedFields(Ship ship) { var mines = Gameboard.GetMines(); var otherShips = Gameboard.GetShips().Where(x => x.EntityId != ship.EntityId); var cannonBalls = Gameboard.GetCannonballs(); return(mines.Cast <Entity>() .Concat(otherShips.Cast <Entity>()) .Concat(cannonBalls.Cast <Entity>()) .Select(x => Gameboard.Fields[x.Col, x.Row])); }