I want to create random tables for roleplaying games. I have N items I want to go on the random table, and there are M optional items that could also go on that table. What are all the possible rolling schemes, using standard RPG dice, that could cover all the required items on the table, using the optional items to pad the table?
My solution is a breadth-first search which prints out possible dice schemes. You could modify it to return the schemes instead of printing them. There are constraints you can change at the top of the file.
Run this way:
$ python3 dicebag.py
I have chosen some constraints, you can turn "weird handfuls" and "weird double handfuls" on and off, though if weird double handfuls is enabled, weird handfuls should be too.
- Don't use more than two kinds of dice
WEIRD_HANDFULS
- when this is True, if you are using two kinds of dice, you can have more than one of one kind.WEIRD_DOUBLE_HANDFULS
- when this is True, if you are using two kinds of dice, you can have more than one of both kinds.
Disabing both WEIRD_HANDFULS and WEIRD_DOUBLE_HANDFULS means that if two dice are used, only one of each is used, ex:
1d8+1d20
But never:
2d8+1d20 (weird handful)
4d8+2d20 (weird double handful)
$ python3 dicebag.py
Solutions for 29 items with 6 optional items
1d6+9d4 (10-42), 33 possible items
4d8+1d6 (5-38), 34 possible items
6d6+1d4 (7-40), 34 possible items
1d20+5d4 (6-40), 35 possible items
1d20+2d6 (3-32), 30 possible items
3d10+1d6 (4-36), 33 possible items
3d10+1d8 (4-38), 35 possible items
1d8+9d4 (10-44), 35 possible items
1d20+2d8 (3-36), 34 possible items
1d6+8d4 (9-38), 30 possible items
10d4 (10-40), 31 possible items
1d20+4d4 (5-36), 32 possible items
4d8 (4-32), 29 possible items
1d12+7d4 (8-40), 33 possible items
1d12+4d6 (5-36), 32 possible items
1d10+7d4 (8-38), 31 possible items
1d12+2d10 (3-32), 30 possible items
1d10+3d8 (4-34), 31 possible items
6d6 (6-36), 31 possible items
1d8+8d4 (9-40), 32 possible items
1d8+5d6 (6-38), 33 possible items
3d12 (3-36), 34 possible items
1d10+8d4 (9-42), 34 possible items
1d10+5d6 (6-40), 35 possible items
1d20+1d12 (2-32), 31 possible items
1d20+1d10 (2-30), 29 possible items
2d12+1d8 (3-32), 30 possible items
1d20+3d4 (4-32), 29 possible items
2d12+1d10 (3-34), 32 possible items
1d12+6d4 (7-36), 30 possible items
1d20+3d6 (4-38), 35 possible items
1d8+7d4 (8-36), 29 possible items
4d8+1d4 (5-36), 32 possible items
11d4 (11-44), 34 possible items
3d10+1d4 (4-34), 31 possible items
1d12+3d8 (4-36), 33 possible items
1d10+4d6 (5-34), 30 possible items
5d6+1d4 (6-34), 29 possible items