/// <summary> /// Bishop Can move diagonally /// </summary> /// <param name="currentPosition"></param> /// <returns></returns> public override List <string> Moves(string currentPosition) { var nextPossibleMove = new List <int>(); var indexs = Helper.GetPositionIndexAndRowIndex(currentPosition); nextPossibleMove.AddRange(diagonalMoves.DiagonalMoveUpward(indexs.currentPositionIndex, indexs.rowIndex)); nextPossibleMove.AddRange(diagonalMoves.DiagonalMoveDownward(indexs.currentPositionIndex, indexs.rowIndex)); nextPossibleMove.AddRange(diagonalMoves.DiagonalMoveReverseUpward(indexs.currentPositionIndex, indexs.rowIndex)); nextPossibleMove.AddRange(diagonalMoves.DiagonalMoveReverseDownward(indexs.currentPositionIndex, indexs.rowIndex)); //Check if the positions are not occupied and are valid moves return(Helper.GettingActualPossibleMove(nextPossibleMove)); }
/// <summary> /// Queen Can move any direction /// </summary> /// <param name="currentPosition"></param> /// <returns></returns> public override List <string> Moves(string currentPosition) { var nextPossibleMove = new List <int>(); var indexs = Helper.GetPositionIndexAndRowIndex(currentPosition); //Possible Moves nextPossibleMove.AddRange(verticalMoves.VerticalDownMoves(indexs.currentPositionIndex)); nextPossibleMove.AddRange(verticalMoves.VerticalUpMoves(indexs.currentPositionIndex)); nextPossibleMove.AddRange(horizontalMoves.HorizontalForwardMoves(indexs.currentPositionIndex, indexs.rowIndex)); nextPossibleMove.AddRange(horizontalMoves.HorizontalReverseMoves(indexs.currentPositionIndex, indexs.rowIndex)); nextPossibleMove.AddRange(diagonalMoves.DiagonalMoveDownward(indexs.currentPositionIndex, indexs.rowIndex)); nextPossibleMove.AddRange(diagonalMoves.DiagonalMoveUpward(indexs.currentPositionIndex, indexs.rowIndex)); nextPossibleMove.AddRange(diagonalMoves.DiagonalMoveReverseUpward(indexs.currentPositionIndex, indexs.rowIndex)); nextPossibleMove.AddRange(diagonalMoves.DiagonalMoveReverseDownward(indexs.currentPositionIndex, indexs.rowIndex)); //Check if the positions are not occupied return(Helper.GettingActualPossibleMove(nextPossibleMove)); }