Efficiency of Recursive Checkers Legal Move Generator
A couple of little things that caught my eye:

You could simplify this

dist = 1 
while True:
    jx, jy = px + dist * dx, py + dist * dy 
    dist += 1


to this:

jx, jy = px, py
while True:
    jx += dx
    jy += dy




You don't need this range check

if not (0 &lt;= jx &lt; 8 and 0 &lt;= jy &lt; 8):
    break
if board[jy, jx] != EMPTY:


because, assuming board is a dict indexed by tuple, you can just catch KeyError when out of bounds:

try:
    if board[jy, jx] != EMPTY:
        ...
except KeyError:
    break




Instead of

((piece &amp; WHITE) and (board[jy, jx] &amp; BLACK) or
 (piece &amp; BLACK) and (board[jy, jx] &amp; WHITE))


you could use board[jy, jx] &amp; opponent if you determine the opponent's color in the beginning of the function:

opponent = BLACK if piece &amp; WHITE else WHITE