예제 #1
0
        //----------------------------------------------------------------------------------------------------------------------------------------

        private List <Int32> getPossibleMoves(ModelItem aFigureToMove, Boolean shouldCheckChess)
        {
            List <Int32> pMoves = new List <Int32>();

            switch (aFigureToMove.figureItem.figureType)
            {
            case FigureType.MOVED_KING:
            case FigureType.KING:
            {
                KingRule kingRule = new KingRule(chessBoard, whiteFigures, blackFigures, mPlayer1Color, aFigureToMove, shouldCheckChess);
                pMoves = kingRule.possibleMoves();
            } break;

            case FigureType.QUEEN:
            {
                QueenRule queenRule = new QueenRule(chessBoard, whiteFigures, blackFigures, mPlayer1Color, aFigureToMove, shouldCheckChess);
                pMoves = queenRule.possibleMoves();
            } break;

            case FigureType.MOVED_ROOK:
            case FigureType.ROOK:
            {
                RookRule rookRule = new RookRule(chessBoard, whiteFigures, blackFigures, mPlayer1Color, aFigureToMove, shouldCheckChess);
                pMoves = rookRule.possibleMoves();
            } break;

            case FigureType.BISHOP:
            {
                BishopRule bishopRule = new BishopRule(chessBoard, whiteFigures, blackFigures, mPlayer1Color, aFigureToMove, shouldCheckChess);
                pMoves = bishopRule.possibleMoves();
            } break;

            case FigureType.KNIGHT:
            {
                KnightRule knightRule = new KnightRule(chessBoard, whiteFigures, blackFigures, mPlayer1Color, aFigureToMove, shouldCheckChess);
                pMoves = knightRule.possibleMoves();
            } break;

            case FigureType.PAWN:
            {
                PawnRule pawnRule = new PawnRule(chessBoard, whiteFigures, blackFigures, mPlayer1Color, aFigureToMove, shouldCheckChess);
                pMoves = pawnRule.possibleMoves();
            } break;

            case FigureType.NO_FIGURE:              break;
            }

            return(pMoves);
        }
예제 #2
0
        //----------------------------------------------------------------------------------------------------------------------------------------

        protected List <Int32> possibleMoves(List <List <ModelItem> > aChessBoard, List <ModelItem> aBlackFigures, List <ModelItem> aWhiteFigures, ModelItem currentFigure)
        {
            List <Int32> possibleMoves = new List <Int32>();

            switch (currentFigure.figureItem.figureType)
            {
            case FigureType.MOVED_KING:
            case FigureType.KING:
            {
                KingRule kingRule = new KingRule(aChessBoard, aWhiteFigures, aBlackFigures, player1Color, currentFigure, true);
                possibleMoves = kingRule.possibleMoves();
            } break;

            case FigureType.QUEEN:
            {
                QueenRule queenRule = new QueenRule(aChessBoard, aWhiteFigures, aBlackFigures, player1Color, currentFigure, true);
                possibleMoves = queenRule.possibleMoves();
            } break;

            case FigureType.MOVED_ROOK:
            case FigureType.ROOK:
            {
                RookRule rookRule = new RookRule(aChessBoard, aWhiteFigures, aBlackFigures, player1Color, currentFigure, true);
                possibleMoves = rookRule.possibleMoves();
            } break;

            case FigureType.BISHOP:
            {
                BishopRule bishopRule = new BishopRule(aChessBoard, aWhiteFigures, aBlackFigures, player1Color, currentFigure, true);
                possibleMoves = bishopRule.possibleMoves();
            } break;

            case FigureType.KNIGHT:
            {
                KnightRule knightRule = new KnightRule(aChessBoard, aWhiteFigures, aBlackFigures, player1Color, currentFigure, true);
                possibleMoves = knightRule.possibleMoves();
            } break;

            case FigureType.PAWN:
            {
                PawnRule pawnRule = new PawnRule(aChessBoard, aWhiteFigures, aBlackFigures, player1Color, currentFigure, true);
                possibleMoves = pawnRule.possibleMoves();
            } break;

            case FigureType.NO_FIGURE:              break;
            }

            return(possibleMoves);
        }