/// <summary> /// CalculateLocations /// </summary> /// <param name="aSquare"></param> /// <param name="isSupportLocation"></param> /// <returns>ArrayList</returns> internal override ArrayList CalculateLocations(ChessSquare aSquare, bool isSupportLocation) { base.CalculateLocations(aSquare, isSupportLocation); if (isSupportLocation) return this.CalculateCaptureLocations(aSquare, isSupportLocation); else { if (chessPlayer.GetPlayerType() == EnumPlayerType.WhitePlayer) { if (originalSquare.GetChessLocation().Y == 1) GoDown( aSquare.GetChessLocation(), 2); else GoDown( aSquare.GetChessLocation(), 1 ); GoLeftDown(aSquare.GetChessLocation(), false); GoRightDown(aSquare.GetChessLocation(), false); } else if (chessPlayer.GetPlayerType() == EnumPlayerType.BlackPlayer) { if (originalSquare.GetChessLocation().Y == 6) GoUp( aSquare.GetChessLocation(), 2 ); else GoUp( aSquare.GetChessLocation(), 1 ); GoLeftUp(aSquare.GetChessLocation(), false); GoRightUp(aSquare.GetChessLocation(), false); } return validSquaresList; } }
/// <summary> /// CalculateLocations /// </summary> /// <param name="aSquare"></param> /// <param name="isSupportPosition"></param> /// <returns>ArrayList</returns> internal override ArrayList CalculateLocations(ChessSquare aSquare, bool isSupportPosition) { base.CalculateLocations(aSquare, isSupportPosition); GoLeftUp ( new Point(aSquare.GetChessLocation().X, aSquare.GetChessLocation().Y), isSupportPosition ); GoLeftDown ( new Point(aSquare.GetChessLocation().X, aSquare.GetChessLocation().Y), isSupportPosition ); GoRightUp ( new Point(aSquare.GetChessLocation().X, aSquare.GetChessLocation().Y), isSupportPosition ); GoRightDown( new Point(aSquare.GetChessLocation().X, aSquare.GetChessLocation().Y), isSupportPosition ); return validSquaresList; }
/// <summary> /// CalculateCaptureLocations /// </summary> /// <param name="square"></param> /// <param name="isSupportLocation"></param> /// <returns>ArrayList</returns> private ArrayList CalculateCaptureLocations(ChessSquare square, Boolean isSupportLocation) { if (chessPlayer.GetPlayerType() == EnumPlayerType.WhitePlayer) { GoLeftDown(square.GetChessLocation(), isSupportLocation); GoRightDown(square.GetChessLocation(), isSupportLocation); } else if (chessPlayer.GetPlayerType() == EnumPlayerType.BlackPlayer) { GoLeftUp(square.GetChessLocation(), isSupportLocation); GoRightUp(square.GetChessLocation(), isSupportLocation); } return validSquaresList; }