What I made
I made a play assistant for the dice game Shut the Box. You type in your roll. It shows you every legal move, ranked. It is live now at https://kleinpanic.github.io/shut-the-box-optimal-strategy/.
The code is at https://github.com/kleinpanic/shut-the-box-optimal-strategy.
What you see
Each move gets an expected value for three different objectives. You also see the survival probability, the shut probability and a chart of the dice distribution.
How it works
The engine uses dynamic programming. It covers all 512 board states, since each of the nine tiles is either up or down. Legal moves come from bitmask subset enumeration. The engine also handles the one-die rule.
The engine lives in src/engine/, in files like dice.ts and moves.ts.
The first commit is called "feat: initial production-quality Shut the Box optimal strategy app". The stack is Vite, strict TypeScript, Tailwind, Vitest and ESLint. That first commit deployed straight to GitHub Pages, so the demo and the code went up together.
Run it yourself
git clone https://github.com/kleinpanic/shut-the-box-optimal-strategy
cd shut-the-box-optimal-strategy
npm install
npm run dev
What is not done
It is a small app. There are only two test files so far.
If a ranking looks wrong to you, tell me. I want to know.
P.S. Thanks for reading. Consider subbing to the RSS feed.
Klein Panic