# Side-Scrolling Field Theory: Solution Problem setter’s solution: determine the sign from the facing direction and maintain the holder with modular arithmetic. Codex (GPT-6) refines input handling, modular boundaries, and the correctness explanation. ## Convert relative directions Use a zero-based holder index $c$ internally, and reindex the facing and label arrays in the same way. A student facing away has their right toward increasing indices. A student facing the observer has their left toward increasing indices. Thus indices increase exactly when $d\ne f_c$ . Set $r=p\bmod N$ . An increasing move becomes $c\leftarrow(c+r)\bmod N$ ; a decreasing move becomes $c\leftarrow(c-r+N)\bmod N$ . Since $0\le c,r