https://github.com/joelburget/corewarjs
Corewar in Javascript
https://github.com/joelburget/corewarjs
Last synced: 9 months ago
JSON representation
Corewar in Javascript
- Host: GitHub
- URL: https://github.com/joelburget/corewarjs
- Owner: joelburget
- Created: 2011-04-25T22:25:36.000Z (over 14 years ago)
- Default Branch: master
- Last Pushed: 2011-04-26T02:22:44.000Z (over 14 years ago)
- Last Synced: 2025-03-20T14:52:53.701Z (9 months ago)
- Language: JavaScript
- Homepage:
- Size: 1.47 MB
- Stars: 3
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README
Awesome Lists containing this project
README
This project aims to write a client/server CoreWar runner in 100% Javascript.
See http://www.corewar.info/
How to test on the server side:
- node tests/parser.js : test parsing on one warrior (edit file to change it)
- node tests/88all.js : run unitest comparing both versions in warriors/88/
- node tests/battle.js : run a battle between 2 imps (and soon more!)
How to run the backend/frontend:
- npm install express request test
- node backend/app.js => frontend should be up at http://localhost:40008
TODO / How to help:
- fix last few bugs in the parser
- fix literal replacement of EQUs
- use a proper JS loader and reduce the number of global variables when in browser mode.
- compare starting points in 88all
- document
- clean the code a bit
- create a nice browser GUI for showing battles (we already have pluggable viewers ! :-)
- create a hill
- create a ACE highlighter for redcode (https://github.com/ajaxorg/ace/tree/master/lib/ace/mode)
- profile and optimize!
Credits:
- Underscore.js
- Math Parser : http://silentmatt.com/javascript-expression-evaluator/
- Core/Warrior code forked from https://github.com/termie/corewarjs
- Frontend code forked from https://github.com/jeromeetienne/arenajs/tree/master/www/dashboard
License:
- GPLv2
How does the parser work:
This will be documented soon with some slides hopefully that I'll try to present maybe at NodeCamp.eu 2011
Basically, the parser does this :
- redcode.preparse(redcode) => javascript
- eval(javascript) => array of lines like [["MOV",I],["#",0],["$",42]]
- then the Core/Warrior combo executes them
If you add warriors:
- find warriors -name "*.red" > warriors/list.txt