Hey everyone,
Today I want to share a script for deterministic dice rolls right from the command line. If you know anything about me, you know I live in the terminal. Even though I built the ultimate-dice web app, sometimes I just want to roll some funky click-clack math rocks without leaving my shell. So, I built this.
This script is a bit different from my web-based dice roller. It uses a method inspired by the old dice.js
smart contract from Hive-Engine, seeding its rolls using live data directly from the Hive blockchain to ensure a deterministic and provably fair result.
Hereβs how it works:
block_id
of both blocks and the transaction_id
of the first transaction in the most recent block.The script can handle simple rolls, like a standard 1d20
:
It can also parse more complex dice notation, including multiple types of dice and modifiers, like 1d20+3-2d6+3
:
It's a fun little tool for anyone who loves the command line and wants a quick way to get a provably fair dice roll for a TTRPG or any other reason.
You can find the script and run it directly from the Gist below.
As always,
Michael Garcia a.k.a. TheCrazyGM
If I ever need a dice roller of any sort, I know where to come! I'm curious, when do you use a dice roller in a terminal? π π π β¨ π€
Whenever I'm working on an adventure, for things like rolling on an encounter table, or treasure / magic item tables. To figure out how many HP something has. Basically anytime I don't want to roll physical dice, and since I work on documents in NeoVim, 99% of the time, it's easier than stopping what I'm doing to open a browser and move the mouse around etc.
Ah, OK I see, and that makes sense! Thanks a lot for the explanation, my friend, I appreciate it! πππβ¨π€