コード例 #1
0
ファイル: QueenMoveGenerator.cs プロジェクト: wgwine/ChessGen
        public static List <int> PossiblePositions(int piece, int[] board)
        {
            List <int> result = BishopMoveGenerator.PossiblePositions(piece, board);

            result.AddRange(RookMoveGenerator.PossiblePositions(piece, board));
            return(result);
        }
コード例 #2
0
ファイル: MoveGenerator.cs プロジェクト: wgwine/ChessGen
        public static List <Move> GenerateMovesForPiece(int piece, int[] board)
        {
            PieceType   pt     = Util.GetPieceType(piece);
            List <int>  temp   = new List <int>();
            List <Move> result = new List <Move>();

            switch (pt)
            {
            case PieceType.Pawn:
                temp = PawnMoveGenerator.PossiblePositions(piece, board);
                break;

            case PieceType.Night:
                temp = KnightMoveGenerator.PossiblePositions(piece, board);
                break;

            case PieceType.Bishop:
                temp = BishopMoveGenerator.PossiblePositions(piece, board);
                break;

            case PieceType.Rook:
                temp = RookMoveGenerator.PossiblePositions(piece, board);
                break;

            case PieceType.Queen:
                temp = QueenMoveGenerator.PossiblePositions(piece, board);
                break;

            case PieceType.King:
                temp = KingMoveGenerator.PossiblePositions(piece, board);
                break;

            default:
                break;
            }

            foreach (int m in temp)
            {
                result.Add(new Move(piece, m));
            }
            return(result);
        }