Remix.run Logo
ludwik 3 hours ago

Shouldn't the code say:

    position = (position + direction + 1) % 12;
Or have I misunderstood something?
nulptr 2 hours ago | parent | next [-]

The +12 there is so that % works correctly (ie the number never becomes negative)

LiamPowell 3 hours ago | parent | prev [-]

The +12 is to keep the number positive. The direction contains the movement so a +1 wouldn't make sense.