Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Square Board by juestr
from typing import Tuple
Coordinate = Tuple[int, int]
def square_board(side: int, token: int, steps: int) -> Coordinate:
span = side - 1
quarter, offset = divmod(token + steps, span)
runs = [span, span - offset, 0, offset, span]
return tuple(zip(runs, runs[1:]))[quarter % 4]
Feb. 12, 2020
Comments: