Testing

Unit tests

npm test

Game-specific tests live in test/games/. Good unit tests will save future you (and future maintainers) a lot of headaches. No need to test basic stuff tested elsewhere (like graph/grid functions), but it's wise to test end-of-game resolution and any edge cases. See existing tests for patterns.

CLI example

bin/example.ts — run moves from the command line:

npx ts-node bin/example.ts <uid> [moves...]

Browser playground

The standalone gameslib playground is not part of the docs site:

gameslib.dev.abstractplay.com

To run locally you need:

  1. A local web server (LAMP or similar)
  2. playground/playground.*
  3. APRender.min.js from renderer playground or npm run dist-dev in renderer
  4. APGames.min.js from npm run dist-dev in gameslib

Renderer output

Prototype board JSON at renderer.dev.abstractplay.com before wiring render() in your game.

Example games