This is another somewhat frivolous script I wrote when playing an RPG game where we did not have enough sets of dice. It simulates dice rolls with various modes.
There are three modes:
- Fair dice
- fudge dice
- xkcd dice
The fair dice setting is straightforward, the fudge dice have \([-1,-1,0,0,+1,+1]\), and the xkcd dice always return \(4\), which is an xkcd in-joke. The colors can be chosen to match the fudge dice colours we used in the RPG, and since one of our players had OCD and we’d sometimes exchange dice colors to wind him up, there was an option to choose colors randomly.
- Challenge: Picking random rgb values for the colors means that black is not always the best choice of text color.
- Solution: Add a few lines to see how dark a color is, and change the text to white where suitable. (To be done)