public Board(string fen, MoveController mc) : base(fen) { this.mc = mc; DropEnpassant(); SetEnpassant(); MoveFigures(); ChangeCurrentMoveColor(); MoveCastlingRook(); UpdateCastlingFlags(); ChangeMoveNumber(); CreateNewFen(); }
public Chess Move(string move) { if (!isValidMove(move)) { return(this); } MoveController moveController = new MoveController(move); BoardController newBC = boardController.Move(moveController); Chess newChessEngine = new Chess(newBC); return(newChessEngine); }
public bool isValidMove(string move) { MoveController moveController = new MoveController(move); if (!moves.CanMove(moveController)) { return(false); } if (boardController.isCheckAfter(moveController)) { return(false); } return(true); }
public IEnumerable <string> YieldValidMoves() { foreach (FigureOnCell fc in boardController.YieldFiguresOnCell()) { foreach (Cell cell in Cell.YieldBoardCells()) { foreach (Figure transformation in fc.figure.YieldTransformations(cell)) { MoveController mc = new MoveController(fc, cell, transformation); if (moves.CanMove(mc)) { if (!boardController.isCheckAfter(mc)) { yield return(mc.ToString()); } } } } } }
public bool CanMove(MoveController mc) { this.moveController = mc; return(CanMoveCurrent() && CanMoveNew() && CanFigureMove()); }
public bool isCheckAfter(MoveController mc) { BoardController after = Move(mc); return(after.CanEatKing()); }
public BoardController Move(MoveController moveController) { return(new Board(Fen, moveController)); }