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(); } }
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); }