Connection
Base URL, credentials and a reachable server.
Inspect diagonal_rays.py for the difference between a reached blocker square and a square beyond it.
Base URL, credentials and a reachable server.
A model available through the configured endpoint.
Context limits and tool support are determined by the model and server.
def diagonal_rays(square, occupied):
if type(square) is not int or not 0 <= square < 64 or type(occupied) is not int or not 0 <= occupied < 2**64:
raise ValueError("rays.input")
row, column = divmod(square, 8)
result = 0
for dr, dc in ((1, 1), (1, -1), (-1, 1), (-1, -1)):
r, c = row+dr, column+dc
while 0 <= r < 8 and 0 <= c < 8:
bit = 1 << (8*r+c)
result |= bit
if occupied & bit:
break
r, c = r+dr, c+dc
return result