{"id":43337164,"url":"https://github.com/bobertlo/gmars","last_synced_at":"2026-02-02T00:37:54.371Z","repository":{"id":260835102,"uuid":"875108131","full_name":"bobertlo/gmars","owner":"bobertlo","description":"Go implementation of CoreWar MARS simulator","archived":false,"fork":false,"pushed_at":"2025-12-24T22:07:40.000Z","size":686,"stargazers_count":4,"open_issues_count":12,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-26T11:57:42.555Z","etag":null,"topics":["corewar","mars"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bobertlo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-10-19T05:48:58.000Z","updated_at":"2025-06-27T01:17:33.000Z","dependencies_parsed_at":"2024-11-25T04:34:46.840Z","dependency_job_id":null,"html_url":"https://github.com/bobertlo/gmars","commit_stats":null,"previous_names":["bobertlo/gmars"],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/bobertlo/gmars","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bobertlo%2Fgmars","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bobertlo%2Fgmars/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bobertlo%2Fgmars/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bobertlo%2Fgmars/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bobertlo","download_url":"https://codeload.github.com/bobertlo/gmars/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bobertlo%2Fgmars/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28997114,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-01T23:10:54.274Z","status":"ssl_error","status_checked_at":"2026-02-01T23:10:47.298Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["corewar","mars"],"created_at":"2026-02-02T00:37:53.785Z","updated_at":"2026-02-02T00:37:54.359Z","avatar_url":"https://github.com/bobertlo.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gMARS\n\n[![Go\nReference](https://pkg.go.dev/badge/github.com/bobertlo/gmars.svg)](https://pkg.go.dev/github.com/bobertlo/gmars/)\n[![Go Report\nCard](https://goreportcard.com/badge/github.com/bobertlo/gmars)](https://goreportcard.com/report/github.com/bobertlo/gmars)\n\ngMARS is an implementation of a Core War Memory Array Redcode Simulator (MARS)\nwritten in Go.\n\n![vmars screenshot](screenshot.png)\n\nIn the the game of Core War, two virus-like programs written in assembly fight\nagainst each other in the memory of a Simulator where they are able to write and\nexecute new code and modify eachother. For more information about Core War see:\n\n- [Wikipedia](https://en.wikipedia.org/wiki/Core_War): CoreWar entry\n- [corewar.co.uk](https://corewar.co.uk/): John Metcalf's Core War Site with\n   tutorials, history, and links.\n- [KOTH.org](http://www.koth.org/): A King of the Hill server with ongoing\n   competitive matches, information, and links.\n- [Koenigstuhl](https://asdflkj.net/COREWAR/koenigstuhl.html): An 'infinite\n   hill' site that collects warriors and publishes their rankings and source\n   code.\n\n## Why another MARS?\n\ngMARS was created to provide a reference implementation of a MARS in Go. There\nare many other implementations but I wanted to meet the following requirements:\n\n1. A thread-safe library implementing the MARS mechanics.\n2. Strong compliance to standards, with R/W limits and '88 rules enforcment.\n3. Reporting hooks to support custom front-ends and analysis engines.\n4. A modern visual simulator front-end.\n\n## Running the Simulator\n\nCurrently only two warrior matches are supported and the warrior files must be\nsupplied as command line arguments. Both versions also accept the following\narguments\n\n```\n  -preset string\n        Load named preset config (and ignore other flags)\n  -8    Enforce ICWS'88 rules\n  -F int\n        fixed position of warrior #2\n  -c int\n        Cycles until tie (default 80000)\n  -debug\n        Dump verbose debug information\n  -l int\n        Max. warrior length (default 100)\n  -p int\n        Max. Processes (default 8000)\n  -r int (CLI only)\n        Rounds to play (default 1)\n  -s int\n        Size of core (default 8000)\n```\n\n### Presets\n\nYou can use the `-preset \u003cname\u003e` flag to use a named presed configuration. If a\npreset is loaded, the other flags are not parsed and applied.\n\n| Name    | Simulator Mode | CoreSize | Length | Processes | Cycles |\n|---------|----------------|----------|--------|-----------|--------|\n| nop94   | `NOP94`        | 8000     | 100    | 8000      | 80000  |\n| 88      | `ICWS88`       | 8000     | 100    | 8000      | 80000  |\n| icws    | `ICWS88`       | 8192     | 300    | 8000      | 100000 |\n| noptiny | `NOP94`        | 800      | 20     | 800       | 8000   |\n| nop256  | `NOP94`        | 256      | 10     | 60        | 2560   |\n| nopnano | `NOP94`        | 80       | 5      | 80        | 800    |\n\n### Visual MARS Controls\n\nKeyboard controls:\n\n- `Space` to start/pause the simulation\n- `Up/Down` to increase or decrease simulation speed\n- `Left/Right` to stop or step forward one frame of the simulation (at the\n   visualizer speed)\n- `R` to reset the simulator with the next starting position\n- `Escape` to quit\n\nExtra Arguments:\n\n- `-showread`: Enable recording and rendering of CoreRead states.\n\n### CLI MARS\n\nWhen the simulation completes in the gmars CLI, a line is printed for each\nwarrior with the number of wins and ties:\n\n```\n1 0\n0 0 \n```\n\n## Implemented Features\n\n- Compilation of code compliant with the ICWS'94 standard specification\n   (favoring pMARS compatibility when applicable)\n- ICWS'88 compilation mode to enforce valid code generation.\n- Simulation of two warrior battles\n- Read/write limits (implemented, but not thoroughly tested)\n- Hooks generating updates for visualization and analysis\n- Visual MARS with interactive keyboard controls\n\n## Planned Features\n\n- P-Space support\n- Interactive debugger\n- Round robin and benchmark modes\n\n## Language Support\n\nI have implemented the ICWS'94 Draft Standard to the best of my ability and\nadded the following modifications based pMARS and other simulators:\n\n### Empty Fields\n\nIn the draft standard, if only a single operand is applied, it is placed in the\nB-Field for `DAT` instructions, or otherwise placed in the A-Field. In both\ncases `#0` is supposed to be placed in the remaining field.\n\nI found that corewin and pMARS load `$0` into the B-Field when the instruction\nopcode is not `DAT`. Since this can cause divergent outcomes, I chose to follow\nother simulators for compatibility.\n\n### FOR/ROF Macros\n\n`FOR` and `ROF` pseudo-opcodes have been added including labels and embedded for\nloops.\n\n```\n\u003cstart_ref...\u003e \u003ccount_var\u003e FOR \u003ccount_expr\u003e\n...\nROF\n```\n\nThe count variable starts at 1 and increments for each following line until it\nequals the value of the count expression. Other labels added before the count\nvariable name will be evaluated as line references to the first line emitted by\nthe macro.\n\nVariable concatenation with the `\u0026` pseudo op is not implemented but planned.\n\n#### Start Address Example\n\n```\nstart i FOR 2\nDAT start, i\nROF\n```\n\nCompiles to:\n\n```\nDAT.F  $  0, $  1\nDAT.F  $ -1, $  2\n```\n\n#### Embedded Loop Example\n\n```\ni FOR 2\nj FOR 2\nDAT i, j\nROF\nROF\n```\n\nCompiles to:\n\n```\nDAT.F  $  1, $  1\nDAT.F  $  1, $  2\nDAT.F  $  2, $  1\nDAT.F  $  2, $  2\n```\n\n### Non-Supported Extensions\n\npMARS allows assignment to variables with a syntax appearing as\n`(a=CORESIZE/2)`. This feature is not currently implemented, and I am not sure\nif I will plan to do so.\n\n## Testing Status / Known Bugs\n\nThe compiler is more subjective and still going through testing and active\ndevelopment, but the backend has been tested fairly thoroughly by running\ncompiled load code and comparing outcomes to pMARS.\n\nLoad code tests were done with the 94nop and 88\n[Koenigstuhl](https://asdflkj.net/COREWAR/koenigstuhl.html) hills. I found a\nsingle warrior [Rush\n(11,1)](https://asdflkj.net/COREWAR/94/HILL32/rush_11_1.red) that has\ninconsistent outcomes, which I am stil investigating.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbobertlo%2Fgmars","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbobertlo%2Fgmars","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbobertlo%2Fgmars/lists"}