I will probably do this using the x, y coordinates on the board: this will make it easier to check the boundary conditions at the board borders, something like
(defn se [x y]
"Produces a ray attack from the indexed bit in the south-east direction"
(let [initial (bit-shift-left (bit-shift-left (long 1) x) (* y 8))
dx 1 ;; x direction
dy 1 ;; y direction
distance (min
(- 7 x)
(- 7 y))
shift (+ dx (* 8 dy))]
(loop [value 0
distance distance]
(if (<= distance 0)
value
(recur (bit-or value (bit-shift-left initial (* distance shift))) (dec distance))))))
(defn bits [^long bitboard]
(map
(range 64)))
(defn display [bitboard]
(let [bits (partition 8 (bits bitboard))]
(doseq [ss bits]
(println (apply str ss)))))
(display (se 1 3))
00000000
00000000
00000000
00000000
00100000
00010000
00001000
00000100
, (dx, dy) , . (1,0) , . , (2,1) .....
, , .