예제 #1
0
        public static int GetRealIndex(this Square sq)
        {
            int file = (int)BitBoardHelper.GetFileFromSquare(sq);
            int rank = BitBoardHelper.GetRankFromSquare(sq);

            return((7 - rank) * 8 + file);
        }
예제 #2
0
        public static int GetDeltaY(this Move move)
        {
            int rankStart = BitBoardHelper.GetRankFromSquare(move.From);
            int rankEnd   = BitBoardHelper.GetRankFromSquare(move.To);

            return(rankEnd - rankStart);
        }
예제 #3
0
        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);
        }
예제 #4
0
파일: SquareItem.cs 프로젝트: uri65/Queem
        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;
            }
        }