Do you use Troll? (dice probabilities)

edited August 2008 in Stuff to Watch
So, has anyone trolled? What I mean is:

Troll is language for describing dice roll mechanisms, as well as an interpreter which also calculates the probabilities between the different alternatives in the mechanics described.

According to the creator Torben Mogesen, Troll's predecessor Roll has been used by White Wolf to calculate probabilities for several alternative dice-roll mechanisms during the development of the new version of the RPG World of Darkness.

(Regardless of that) I've found Troll to be very useful when assessing dice-rolling mechanisms. Has anyone of you used it?

Troll's homepages

My blog post on Troll (describes the features of Troll)

BTW, to use Troll you'll need to have Moscow ML. You can get it here.


  • I've tried it, but wasn't able to put the time in to learn properly how to use it. Seemed a pretty steep learning curve.
  • edited August 2008
    I just played with it thanks to this post. Using it and Google Docs, I got this curve for one of my latest game ideas:

  • edited August 2008
    I used it when it was just Roll, before Prof. Mogensen switched it to Moscow ML. I've done some pretty complex dice calculation for Verge with it. I have a sample program on that page.

    I haven't looked at Troll.

    Let me know if you need help writing dice programs.
  • I've used Troll quite a bit. Syntactically I think it's rather evil, but there's nothing else out there that comes close for flexibility and power.
  • w00t I played with troll for an hour, it was like X-mas morning ! :D

    The syntax isn't impossible but it would help if the language made collections and singletons more distinguishable.
  • Yes, after playing with easier rolls and collections I've run into some problems, too. I've thought about putting together a tutorial that would illustrate how to use Troll with examples calculating probabilities of dice mechanics of different popular story games. It'll take some thinking about, in particular the Sorcerer dice seem hard to describe in Troll terms.
  • edited August 2008
    I only know the dice mechanics of Sorcerer from what I read on the web. But I tried to model that in Troll. Let's say two players oppose : player1 has i dice, player 2 has j dice and N is number of sides on the dice they chose to use in the game. I model the result as follow :

    function compare(a,b) = if (max a)>(max b) then 1 else (if (max a)<(max b) then -1 else call compare(least ((count a)-1) a, least ((count b)-1) b))

    x := I D N; y := J D N; call compare(x,y)

    convention : 1 is the result if player 1 wins, -1 is when player 2 wins.
    disclaimer: some parenthesis may be unnecessary but I don't care to learn Troll operators precedences.

    When I run the case player 1 has a 5d10 pool and player 2 has 4d10 I type the following command :
    troll -3 filename.txt I=5 J=4 N=10
    notice the -3 parameter in the command, it limits how many recursive calls to the compare function. It means I consider that the two players won't have more than two ties among their highest dice.

    Here are the result I get in this case :
    Value % = % >=
    -1 : 42.4252657 100.0
    1 : 57.5747343 57.5747343

    Average = 0.151494686 Spread = 0.988458072006 Mean deviation = 0.97704936011
  • When tested with 6d20 against 4d20 my first version of the Sorcerer doesn't get any result after several hours....

    I read the manual again, the little details about normalized probabilities and avoiding function calls. So I came with a better strategy (same conventions) :

    x:= largest 3 (I D N); y:= largest 3 (J D N); if (max x) > (max y) then 1 else if (max x) < (max y) then -1 else if (max(least 2 x))>(max(least 2 y)) then 1 else if (max(least 2 x))<(max(least 2 y)) then -1 else if (min x) > (min y) then 1 else if (min x) < (min y) then -1 else 0
  • Funny thing about the case of Sorcerer : I read the following in a review of the game
    What kind of dice does Sorcerer use? That is entirely up to the players and GM, so long as all the dice are the same type. Just bear in mind that, the more sides your die of choice has, the harder it is for someone with low stats to defeat someone with high stats.
    Well if my model of the game mechanic is right, and Troll is computing right, it seems that it's actually the contrary. I ran three different explorations :
    1. Player 1 has 8d20 and player 2 has 4d20
    2. -------------- 8d10 ------------------- 4d10
    3. -------------- 8d4 -------------------- 4d4
    And here are the results :
    I=8 J=4 N=20
    Value % = % >=
    -1 : 30.2352864731 100.0
    0 : 0.159749216272 69.7647135269
    1 : 69.6049643106 69.6049643106

    I=8 J=4 N=10
    Value % = % >=
    -1 : 26.8730521887 100.0
    0 : 1.0238713456 73.1269478113
    1 : 72.1030764657 72.1030764657

    I=8 J=4 N=4
    Value % = % >=
    -1 : 17.2243475914 100.0
    0 : 8.6407661438 82.7756524086
    1 : 74.1348862648 74.1348862648

    74.1% chance of victory against the challenger when using d4 against 69.6% when using d20. It's not a tremendous difference though.
  • Thank you, Franck! I had conjured up something, but my code was pretty unefficient compared to yours.

    In Sorcerer, the degree of success is determined by counting how many of the winner's dice has bigger results than the loser's. Is there any means of taking the degree of success into the equation other than a series of if-then-else clauses?
  • That's a little more difficult... I shall think about it :)
Sign In or Register to comment.