// true if any such piece in zone internal bool IsOccupied(PlayerKinds kind, PieceValue piece, ZoneValue zone) { if (zone == null) { return(PositionIter().Any(p => IsOccupied(kind, piece, p))); } return(Def.PositionIter(zone, CurrentPlayer).Any(p => IsOccupied(kind, piece, p))); }
internal static PolyZone Create(ZoneValue name, PlayerValue player, IEnumerable <PositionValue> positions) { return(new PolyZone { Name = name.Value, Player = player.Value, Positions = positions.Select(p => p.Value).OrderBy(p => p).Join(" "), }); }
IEnumerable <PositionValue> PositionIter(PlayerValue player, ZoneValue zone) { return(Def.ZoneLookup.SafeLookup(Pair.Create(zone, player))); }
internal bool InZone(ZoneValue zone, PositionValue position) { return(IsValid(position) && Def.InZone(zone, CurrentPlayer, position)); }
// iterate positions for zone and player internal IEnumerable <PositionValue> PositionIter(ZoneValue zone, PlayerValue player) { return(ZoneLookup[Pair.Create(zone, player)]); }
// enquiry functions internal bool InZone(ZoneValue zone, PlayerValue player, PositionValue position) { var z = ZoneLookup.SafeLookup(Pair.Create(zone, player)); return(z != null && z.Contains(position)); }
void s_Name(ZoneValue name) { _zone.Name = name; }
BoolValue s_NotInZone_(ZoneValue zone, PositionOrDirection posordir = null) { return(s_Not(s_InZone_(zone, posordir))); }
BoolValue s_InZone_(ZoneValue zone, PositionOrDirection posordir = null) { return(BoolValue.Create(_board.InZone(zone, ToPosition(posordir)))); }