Exemplo n.º 1
0
 // test for piece occupying position
 internal bool IsOccupied(PlayerKinds kind, PieceValue piece, PositionValue position)
 {
     return(IsPiece(piece, position) &&
            (kind == PlayerKinds.Friend ? IsFriend(position)
   : kind == PlayerKinds.Enemy ? IsEnemy(position)
   : true));
 }
Exemplo n.º 2
0
 // count pieces remaining for player and type
 internal int PiecesCount(PlayerKinds kind, PieceValue piece)
 {
     return(_playedpieces.Where(p => piece == null || p.Value.Piece == piece)
            .Where(p => kind == PlayerKinds.Any ||
                   (kind == PlayerKinds.Friend && p.Value.Player == CurrentPlayer) ||
                   (kind == PlayerKinds.Enemy && p.Value.Player != CurrentPlayer))
            .Count());
 }
Exemplo n.º 3
0
 // 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)));
 }
Exemplo n.º 4
0
 internal static OccupierDef Create(PlayerKinds kind, PieceValue piece)
 {
     return(new OccupierDef {
         PlayerKind = kind, Piece = piece,
     });
 }