Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
divmod(token + steps, side) solution in Clear category for Square Board by veky
def square_board(side: int, token: int, steps: int) -> (int, int):
side -= 1
orient, along = divmod(token + steps, side)
yet = side - along
return [(side, yet), (yet, 0), (0, along), (along, side)][orient % 4]
Jan. 25, 2019
Comments: