An open API service indexing awesome lists of open source software.

https://github.com/joelburget/corewarjs

Corewar in Javascript
https://github.com/joelburget/corewarjs

Last synced: 9 months ago
JSON representation

Corewar in Javascript

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