Implement missing instructions (JMZ, JMN, DJN, CMP, SLT) #4

Open
Claude wants to merge 2 commits from Claude/corewars-test:agent/issue-3 into master
First-time contributor

Implements the opcodes Mars.step still 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 / END now 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

Implements the opcodes `Mars.step` still 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` / `END` now 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
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Owner

@Claude unit tests are not necessary here

@Claude unit tests are not necessary here
Owner

@Claude please do a qquick test about you renviornment, then make a commit on thi sPR, then reply to me with your env info

@Claude please do a qquick test about you renviornment, then make a commit on thi sPR, then reply to me with your env info
Author
First-time contributor

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

  • OS: openSUSE Tumbleweed (20261010), kernel 7.3.0-rc4-next-20260925, x86_64
  • Host: r-desktop, running as user claude with home /home/claude
  • Hardware: 24 CPUs, 62 GiB RAM (about 45 GiB available)
  • Disk: the working volume is 3.7 TB and 97% full, with about 126 GB free
  • Working directory: a per-job checkout at /run/claude-forge-agent/.../repo, on branch agent/issue-3
  • Tools found on PATH: git 2.56.0, python3, gcc, make, cargo, go, node, gh
  • Model: Claude Sonnet 5.5 (claude-sonnet-5-5)

I didn't build or run the project's code. I only listed which tools are installed.

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** - **OS:** openSUSE Tumbleweed (20261010), kernel `7.3.0-rc4-next-20260925`, x86_64 - **Host:** `r-desktop`, running as user `claude` with home `/home/claude` - **Hardware:** 24 CPUs, 62 GiB RAM (about 45 GiB available) - **Disk:** the working volume is 3.7 TB and 97% full, with about 126 GB free - **Working directory:** a per-job checkout at `/run/claude-forge-agent/.../repo`, on branch `agent/issue-3` - **Tools found on PATH:** git 2.56.0, python3, gcc, make, cargo, go, node, gh - **Model:** Claude Sonnet 5.5 (`claude-sonnet-5-5`) I didn't build or run the project's code. I only listed which tools are installed.
Requested by Levitating on PR #4; no file changes.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u agent/issue-3:Claude-agent/issue-3
git switch Claude-agent/issue-3

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.

git switch master
git merge --no-ff Claude-agent/issue-3
git switch Claude-agent/issue-3
git rebase master
git switch master
git merge --ff-only Claude-agent/issue-3
git switch Claude-agent/issue-3
git rebase master
git switch master
git merge --no-ff Claude-agent/issue-3
git switch master
git merge --squash Claude-agent/issue-3
git switch master
git merge --ff-only Claude-agent/issue-3
git switch master
git merge Claude-agent/issue-3
git push origin master
Sign in to join this conversation.
No reviewers
No labels
agent
claude
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Levitating/corewars-test!4
No description provided.