16 of 16ComputingIndividual2024

Dots & Boxes

Two players, one grid, a little sabotage.

Over 1000 lines of pure functional JavaScript: no shared state, and every move returns a new immutable game state. JSLint strict, documented with JSDoc, and 100% Mocha test coverage.

Close a box, go again.
Dots & BoxesSoftwareNot to scaleSheet 16
Brief
Build a complete game in pure functional JavaScript, documented and tested.
Role
Individual.
Outcome
A playable game with a documented API and 100% test coverage.
1000+
lines of pure functions
100%
test coverage
  • JavaScript
  • Pure functions
  • Mocha
  • JSDoc
DesignEngineeringResearchRootsDE NIRORotaryOwnershipMEDIBreatheTalking HatTMJFlowCoolingAirseatBalanceSwipeChairHeat GunDots & Boxes
Logic is framework-free, so the interface can change without rewriting the rules.
A note of my own
How it worksStep 01 of 04
  1. 01

    Set up

    Name the players, pick a theme, start the clock.

  2. 02

    Play

    Exactly one edge per move.

  3. 03

    Claim

    Close a box and go again.

  4. 04

    Prove

    Documented with JSDoc, linted strict, tested to the last edge case.