Replace chapter 3 demos with official NKS versions#5
Conversation
There was a problem hiding this comment.
Codex Review: Here are some suggestions.
Reply with @codex fix comments to fix any unresolved comments.
About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".
| buildInstructions(ruleNumber) { | ||
| const action0 = decodeInstruction(ruleNumber % 4); | ||
| const action1 = decodeInstruction(Math.floor(ruleNumber / 4) % 4); | ||
| return { 0: action0, 1: action1 }; |
There was a problem hiding this comment.
[P1] Decode mobile automaton rules for the wrong cell values
The rule decoder assigns the low‑order base‑4 digit to the white‑cell transition and the high‑order digit to the black‑cell transition (buildInstructions uses ruleNumber % 4 for state 0 and Math.floor(ruleNumber / 4) for state 1). Wolfram’s numbering scheme encodes the 0‑cell instruction in the high‑order digit and the 1‑cell instruction in the low‑order digit, so the mapping is reversed. For example, selecting rule 9 should yield 0→1L, 1→0R, but the current code runs 0→0R, 1→1L. Every rule therefore simulates the wrong behaviour relative to the descriptions and the original NKS demo. Swap the digits when decoding so that each dropdown choice executes the intended rule.
Useful? React with 👍 / 👎.
Summary
Testing
https://chatgpt.com/codex/tasks/task_e_68cfe086c0a08322b86d803882ac8eb8