Fri Dec 23 18:49:18 2016 by JJ |

I have used non-standard dice in Troll many times [A D6 that has a 0 where the 3 should be, a D8 that has sides {0,1,2,4,8,16,32,64}, etc]. Something I've done many time elsewhere (usually spreadsheets); is map a D100 to a smaller list of weighted outcomes [analogous to an item or treasure table with 20 outcomes of varying unequal probabilities].I've never done mapping in Troll for anything beyond a D10 or so, since the list gets big; but since it seems like something that could/would be helpful to others beyond myself; I was going to ask you what the most straightforward way to accomplish that would be? I'm assuming its going to be to define a hybrid choose function; but how to best load the list of individual probabilities I'm not sure of; and how to generalize the function for various uses. For the sake of specifics: say I want to roll a D100, and have it generate one of 20 outcomes with individual probabilities of {9,4,5,6,5,4,10,5,5,1,2,5,7,6,6,1,4,4,4,7}. While most “book” cases start with a D100 list; I would think it would be more general and helpful to generalize it to a D(x), where (x) is the sum of the weighted set of probabilities supplied. (This would also eliminate any malfunctions from math errors where the user-supplied set of probabilities dont sum to exactly 100); and where the number of possible outcomes was the count of the same set. [A user-supplied set of {2,4,18,43,1,5,9}; would roll a D82 and output a number from 1 to 7, mapped to those individual probabilities.] Assuming I havent been confusing, or left anything out; what would be the best way to create this? Thanks again for the great tool and all your help. P.S. would you ever consider licensing out the dice version of "captcha" you've created? I think other gaming and such site might like to use it, if you did. |

Thu Dec 29 16:45:31 2016 by Torben |

You can write, for example,`choose {9#1, 4#2, 5#3, 6#4, 5#5, 4#6, 10#7, 5#8, 5#9, 10, 2#11, 5#12, 7#13, 6#14, 6#15, 16, 4#17, 4#18, 4#19, 7#20}` to get a weighted d20 like the one you describe in the first list. The second list can be obtained by `choose {2#1, 4#2, 18#3, 43#4, 5, 5#6, 9#7}` Writing x#y is an abbreviation for writing y x times. As for the dice captcha, it is written in Standard ML, so it would only work on sites written in this language, which very few are. |