Esempio n. 1
0
        public bool CellIsValidForKing(Cell cellFrom, Cell cellTo, List <ValidBoardMove> enemyPressure)
        {
            var moveProps = new ValidNotationProperties();

            moveProps = moveProps.DetermineMoveProperties(cellFrom, cellTo, enemyPressure);
            if (moveProps.IsValid && !moveProps.IsProtected)
            {
                return(true);
            }
            return(false);
        }
Esempio n. 2
0
        public ValidNotationProperties CellIsValid(Cell fromCell, Cell toCell)
        {
            var validMoveProps = new ValidNotationProperties();

            if (this.TypeOfPiece != PieceType.Pawn)
            {
                return(validMoveProps.DetermineMovePropertiesForPiece(fromCell, toCell));
            }
            else
            {
                return(validMoveProps.DetermineMovePropertiesForPawn(fromCell, toCell));
            }
        }
Esempio n. 3
0
        public ValidBoardMove DetermineIfCellValid(Cell fromCell, Cell toCell, ValidBoardMove.MovePath path)
        {
            ValidNotationProperties validMoveProps = this.CellIsValid(fromCell, toCell);
            var move = new ValidBoardMove(fromCell.Coordinates, toCell.Coordinates, path, this.isWhite);

            if (validMoveProps.IsValid || validMoveProps.IsProtected)
            {
                this.PiecePressure.Add(move);
            }
            if (validMoveProps.IsPotentiallyPinned)
            {
                this.startingCell = fromCell;
                this.PinnedCell   = toCell;
                DetermineIfAbsolutePinned(toCell, path);
            }
            move.MoveProperties = validMoveProps;
            return(move);
        }