Module utils

Source
Expand description

Miscellaneous utilities

Functionsยง

constrain
Constrain value into 0..upper by adding or subtracting upper as many times as necessary.
in_direction
Repeatedly call move_in_direction until the returned value is None.
move_in_direction
Move a two-dimensional coordinate into a given direction provided that:
uint_sqrt
Return the square root of n if n is square, None otherwise.