public static int GetRealIndex(this Square sq) { int file = (int)BitBoardHelper.GetFileFromSquare(sq); int rank = BitBoardHelper.GetRankFromSquare(sq); return((7 - rank) * 8 + file); }
public static int GetDeltaY(this Move move) { int rankStart = BitBoardHelper.GetRankFromSquare(move.From); int rankEnd = BitBoardHelper.GetRankFromSquare(move.To); return(rankEnd - rankStart); }
public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture) { Square start = (Square)values[0]; Square end = (Square)values[1]; double actualHeight = (double)values[2]; int rankStart = (int)BitBoardHelper.GetRankFromSquare(start); int rankEnd = (int)BitBoardHelper.GetRankFromSquare(end); return((rankEnd - rankStart) * actualHeight); }
public void SetBackgroundColor(Square square) { int file = (int)BitBoardHelper.GetFileFromSquare(square); int rank = BitBoardHelper.GetRankFromSquare(square); if (0 == ((7 - file) + rank) % 2) { this.SquareColor = Color.White; } else { this.SquareColor = Color.Black; } }