Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Cycle (de)composition solution in Creative category for Rolling 🎲! by veky
import itertools
c = lambda *e: dict(itertools.pairwise([1, *e, 1]))
d = dict(N=c(2,6,5), W=c(3,6,4), S=c(5,6,2), E=c(4,6,3))
def rolling_dice(moves: str, s: int = 1) -> int:
for m in reversed(moves): s = d[m].get(s, s)
return s
May 1, 2023
Comments: