Rules and notation
Trace a sliding piece’s path
A bishop, rook or queen stops at the first occupied square on its line. It may capture an enemy on that square but cannot jump over it.
Worked example
Position in text
White to move. White: pawn e3, king a1, bishop c1. Black: king h8, pawn g5.
FEN: 7k/8/8/6p1/8/4P3/8/K1B5 w - - 0 1
The bishop on c1 can move to d2. Its own pawn on e3 stops the line, so neither f4 nor the black pawn on g5 is reachable. If the e3-pawn later advances, trace the whole line again instead of assuming the old restriction holds.
A plausible mistake
Do not count an enemy piece as a bridge to the square behind it. Capturing the first enemy ends the move on that square.
Try it yourself
Position in text
White to move. White: pawn d5, rook d2, king c1. Black: king h8, knight d7, pawn a2.
FEN: 7k/3n4/8/3P4/8/8/p2R4/2K5 w - - 0 1
Trace the rook from d2 upward to d8 in the second diagram. Which squares can it reach on that ray? Could it take the a2-pawn on the same turn instead?
Check your answer
It can reach d3 and d4, but its pawn on d5 stops it before the knight on d7. Along rank 2, the route via c2 and b2 is clear, so Rxa2 is legal.