public override bool IsAllowedMove(IMove move) { if (move.Direction() == MoveDirection.Horizontally || move.Direction() == MoveDirection.Verticaly) { return(true); } return(false); }
public override bool IsAllowedMove(IMove move) { if (move.Direction() == MoveDirection.Diagonally) { return(true); } return(false); }
private bool isNormalMove(IMove move) { if (move.Direction() == MoveDirection.Verticaly && move.SenseVertical() == pawnForwardSense && move.Distance() == DistanceEnum.OneSquare) { return(true); } return(false); }
public override bool IsAllowedCapture(IMove move) { if (move.Direction() == MoveDirection.Diagonally && move.SenseVertical() == pawnForwardSense && move.Distance() == DistanceEnum.OneSquare) { return(true); } return(false); }
private bool isLongFirsrMove(IMove move) { if (move.Direction() == MoveDirection.Verticaly && move.SenseVertical() == pawnForwardSense && move.Distance() == DistanceEnum.TwoSquares && Moved == false) { return(true); } return(false); }
public List <IMove> Castling(IMove move, IBoard board) { if (move.Distance() == DistanceEnum.TwoSquares && move.Direction() == MoveDirection.Horizontally && !Moved) { Position rookPosition; int castlingDirection = move.SenseHorizontal(); if (castlingDirection == 1) { rookPosition = new Position(7, currentPosition.y); } else { rookPosition = new Position(0, currentPosition.y); } IPiece rock = board.GetFigureAt(rookPosition); if (rock != null) { if (rock.Type == PiecesTypesEnum.Rock && !rock.Moved && !board.AreAnyPiecesBetwen(currentPosition, rock.currentPosition) && !board.IsCheck(color) && !board.IsFieldAttacked(new Position(currentPosition.x + castlingDirection, currentPosition.y), color) && !board.IsFieldAttacked(new Position(currentPosition.x + 2 * castlingDirection, currentPosition.y), color) && !board.IsFieldAttacked(move.Destination, color)) { List <IMove> result = new List <IMove>(); result.Add(move); result.Add(new Move(rookPosition, new Position(currentPosition.x + castlingDirection, currentPosition.y))); return(result); } } } return(null); }