This is a node module to easily work/play with typescript on different CodinGame projects (classic puzzles or bot battles)
We should be able to create a new project and npm install this one, which would allow you to play CodinGame with your favorite IDE by :
- creating a template with
- "README" file (to put game rules)
- "exercises" folder (to put games data),
- provide a few helpers (e.g.
readline()
)
- Install the dependencies:
npm i @types/node@22 tsx@4 typescript@5 @doriongilmore/codingame-ts-engine
- Copy one of the templates:
cp node_modules/@doriongilmore/codingame-ts-engine/template/puzzle/* -r .
cp node_modules/@doriongilmore/codingame-ts-engine/template/puzzle.multifile/* -r .
- Then add the following scripts to your package.json:
"dev": "tsx src/index.ts",
"build": "npx tsx node_modules/.bin/buildForCodingame.ts"
After executing your new dev script, you should see the following in console:
~/workspace/new-cg-game$ npm run dev
> new-cg-game@1.0.0 dev
> tsx src/index.ts
------ Game started ------
answer
answer
answer
answer
answer
Failure
Found: answer
Expected: ##########
------ Game finished. Result : fail ------
If that's the case, you're ready to work on your puzzle! Start by looking into
src/playerScript.js
(your player logic)src/index.ts
(mechanism to run one or several puzzles)exercises
you should update files for your current puzzle
Check the following for a complete implementation:
- framework for classic puzzles (input - compute - output) ✅
- "init" a run with inputs and expected outputs ✅
- simulate "readline" codingame utility ✅
- compare player output vs expected output ✅
- build tool ✅
- basic usage (remove engine parts & uncomment
main(readline)
call) ✅ - add support for custom imports ✅
- basic usage (remove engine parts & uncomment
- node module ✅
- export utilities from 1 & 2 ✅
- create specific architecture during installation (see /template folder) ✅
- framework for more advanced games ⏳