Skip to content

Getting started ​

Roll in 30 seconds ​

Try it here: 2d20kh1+5
sh
npm install @johnmorrisdotca/korokoro    # or pnpm add, or yarn add
ts
import { chanceAtLeast, parseNotation, roll } from "@johnmorrisdotca/korokoro";

const attack = parseNotation("2d20kh1+5")!;  // advantage, plus 5
roll(attack).total;                          // 6 to 25, from the crypto generator
chanceAtLeast(attack, 15);                   // 0.7975: the exact chance of 15 or more

And 44 games come with their dice and their rules for reading them:

ts
import { crapsPass, rollPreset } from "@johnmorrisdotca/korokoro";

rollPreset("yahtzee").reading.text;        // "A full house", "Chance, for 13", …
rollPreset("チンチロリン", { language: "ja" }).reading.text;  // "シゴロ(4・5・6)", …
crapsPass();                                // [244n, 495n]: the shooter's exact chance, 244 in 495

And from a terminal, on Linux, macOS or Windows:

sh
npx @johnmorrisdotca/korokoro 2d20kh1+5 --seed table   # 2d20kh1+5: 24  [19 (12)]

Or with nothing to install, roll some dice in the demo.

Who it is for ​

  • Roleplaying games. A d20 with advantage (2d20kh1+5), ability scores (4d6dl1), a fireball's damage (8d6), a d20 and a d4 together (1d20+1d4). For Dungeons & Dragons, Pathfinder and anything else that rolls polyhedral dice.
  • Board games and dice games. 2d6 for the table; five dice with holds for Yahtzee (5d6); six for Farkle (6d6); a die with your game's own faces (d[Hit,Miss,Miss]).
  • Fun. Tap the felt.
  • Teaching and research. The exact odds and a chart for any roll: 2d6 makes 7 one time in 6. A seed makes a classroom's rolls repeatable.
  • The curious and the suspicious. Loaded dice that say they are loaded (d6{6:3}), and a test for whether a real die is fair.

Game names are trademarks of their respective owners. Korokoro is not affiliated with or endorsed by them; it rolls the dice their rules call for.

Features ​

  • Every die a table needs, in any mix. Tap a die to add it: up to ten of d4, d6, d8, d10, d12, d20, d30 and d100, up to four kinds in one roll (1d20+2d4+3), with a bonus, and advantage or disadvantage.
  • Hold and roll again. After a roll, tap a die to hold it and roll the rest, as Yahtzee and Farkle do. The odds follow the dice still to roll.
  • And any other dice, by notation. A die of any size from 2 sides to 1000, Fate dice, keep or drop (4d6dl1), rerolls (2d6r<3, 2d6ro<3) and exploding dice (3d6!), with what became of each die shown on the felt.
  • Dice pools. Count successes (6d10>=8), with failures that take them away (f=1), dice that explode on the faces you say, compounding and penetrating dice, a least and a most for each die, critical marks, sorted dice and a label for the roll. The odds are exact for all of it.
  • Arithmetic. (2d6+3)*2, 1d20-1d4, floor(4d6/2), max(1d20,1d20)+5, worked out in exact fractions, with exact odds. And dice that all differ (4d6u).
  • Games, with their dice and their readings. Yahtzee, Risk, craps, backgammon, Catan, Farkle, chō-han (丁半), chinchirorin (チンチロリン) and more: 44 games in one searchable list, each read the way the game reads it, with the exact odds of each outcome. See Games.
  • Several rolls in one tap. 6#4d6dl1 is six ability scores at once, with the highest, the lowest and the sum.
  • Dice of your own. A die with any faces you like, words or numbers (d[Yes,No,Maybe]), and sets of dice saved by name on the device and shared by a link.
  • Loaded dice, honestly marked, and a fairness test. A die weighted to order (d6{6:3}) that says so everywhere it appears, and a chi-square test that tells you whether a die, ours or a real one, looks fair.
  • Fair by construction. Rolls come from crypto.getRandomValues, turned into faces by rejection sampling, so no face is favoured by a modulo.
  • Reproducible when asked. A seeded mode throws the same dice for the same seed on every device, so a table can check a roll.
  • Exact odds. Each total's chance is worked out, never simulated: the chance to meet a target, the average, the spread and how lucky a throw was.
  • History and stats. Up to 500 rolls kept on the device: luck, hot and cold streaks, matching dice, natural 20s and 1s, each face's count with a fairness test, and your totals drawn against the odds.
  • Shareable. Any roll becomes a link that shows exactly what was thrown.
  • A command line. koro 2d20kh1+5 in a terminal on Linux, macOS or Windows, with the odds, the games, JSON and CSV. See The command line.
  • Export. A history as CSV for a spreadsheet, JSON that reads back in, or plain text.
  • Made for a phone. One thumb does everything: every control is at least 44px, nothing needs a hover or a long press, and nothing moves when the dice land. English and Japanese.
  • It feels like dice. Tap anywhere on the felt or press Space. The dice tumble for about half a second and land, with the sound of real dice and a mute button. Light and dark, and themeable. Under reduced motion there is no tumble and the sound starts off.

MIT © John Morris