Ejemplo n.º 1
0
        public IEnumerable <IField> WhereCanBeat(IField field)
        {
            if (field.Pawn == null)
            {
                return(new List <IField>());
            }

            switch (field.Pawn.Type)
            {
            case PawType.PawnChess: return(PawnRules.WhereCanBeat(field));

            case PawType.BishopChess: return(BishopRules.WhereCanMove(field));

            case PawType.KingChess: return(KingRules.WhereCanBeat(field));

            case PawType.KnightChess: return(KnightRules.WhereCanMove(field));

            case PawType.QueenChess: return(QueenRules.WhereCanMove(field));

            case PawType.RockChess: return(RookRules.WhereCanMove(field));

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Ejemplo n.º 2
0
        public MoveChessRules(IBoard board, IList <IPawnHistory> pawnHistoriesList)
        {
            this.board = board;

            PawnRules   = new PawnRules(board, pawnHistoriesList);
            BishopRules = new BishopRules(board);
            KnightRules = new KnightRules(board);
            QueenRules  = new QueenRules(board);
            RookRules   = new RookRules(board);
            KingRules   = new KingRules(board, pawnHistoriesList, WhereCanBeat);
        }