Exemplo n.º 1
0
 public static void AddAllPossibleKnightMoves(List <FastMove> moves, FastIndex start, Team team, FastBoardNode boardNode, bool generateQuiet = true)
 {
     foreach (var target in PrecomputedMoveData.knightMoves[start.ToByte()])
     {
         if (boardNode.TryGetPiece(target, out (Team team, FastPiece piece)occupier))
         {
             if (occupier.team != team)
             {
                 moves.Add(new FastMove(start, target, MoveType.Attack));
             }
         }
         else if (generateQuiet)
         {
             moves.Add(new FastMove(start, target, MoveType.Move));
         }
     }
 }
Exemplo n.º 2
0
    public static void AddAllPossibleRookMoves(List <FastMove> moves, FastIndex start, Team team, FastBoardNode boardNode, bool generateQuiet = true)
    {
        AddAllPossibleRookDirectionalMoves(moves, start, team, boardNode, generateQuiet);

        if (generateQuiet)
        {
            foreach (var target in PrecomputedMoveData.kingMoves[start.ToByte()])
            {
                if (boardNode.TryGetPiece(target, out (Team team, FastPiece piece)occupier))
                {
                    if (occupier.team == team && Contains(DefendableTypes, occupier.piece))
                    {
                        moves.Add(new FastMove(start, target, MoveType.Defend));
                    }
                }
            }
        }
    }