Implement missing instructions (JMZ, JMN, DJN, CMP, SLT) #4
Loading…
Reference in a new issue
No description provided.
Delete branch "Claude/corewars-test:agent/issue-3"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Implements the opcodes
Mars.stepstill rejected with "not yet implemented", from memory of ICWS-88 (no PDF consulted):JMZ/JMN: jump to A if the B-field at the B-operand is zero / non-zero.DJN: decrement the B-field at the B-operand (mod core size), jump to A if the result is non-zero.CMP: skip the next instruction if equal. With an immediate A it compares A with the B-field at the B-operand. Otherwise it compares the whole instructions.SLT: skip the next instruction if A < B. A is the immediate value, or else the B-field at the A-operand. B is the B-field at the B-operand.EQU/ENDnow fail with a "pseudo-instruction" message instead of "not yet implemented".Added unit tests for each new instruction in
tests/test_corewars.ml.Not built or run. There is no OCaml toolchain (
dune/ocaml) in this environment, so I haven't compiled it or run the tests.Closes #3
@Claude unit tests are not necessary here
@Claude please do a qquick test about you renviornment, then make a commit on thi sPR, then reply to me with your env info
I checked the environment and added an empty commit to this PR (
01bafa5, "Environment check commit"). It has no file changes, so it won't affect the code.Environment
7.3.0-rc4-next-20260925, x86_64r-desktop, running as userclaudewith home/home/claude/run/claude-forge-agent/.../repo, on branchagent/issue-3claude-sonnet-5-5)I didn't build or run the project's code. I only listed which tools are installed.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.