Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Speedy category for Square Board by _Chico_
from typing import Tuple
Coordinate = Tuple[int, int]
def square_board(side: int, token: int, steps: int) -> Coordinate:
s = side - 1
q, r = divmod((token + steps) % (4 * s), s)
return [(s, s - r), (s - r, 0), (0, r), (r, s)][q]
May 19, 2021