Something happening I don't understand

Something happening I don't understand

Return to topic list

Tue Jun 10 01:33:22 2014   by   Foxiekins
I may be breaking Troll, but I was trying to use it to guage success probability of a roll versus a difficulty roll.  Difficulty rolls are a number of dice ranging from zero to 5, which is a z5, of course.  Ability rolls range from d2 up.  I was using "if d2 > z5 then choose(1) else choose(0)" to force the results into two categories, success and fail.  There may be a better way to do this, but I couldn't figure one out.  My first test gave a 25% chance of success, which I expected, but when I changed d2 > z5 to d2 > 2z5, instead of the chance of success going down, it went up.  I figure I must be misunderstanding something, but I am at a loss as to what.
 
Tue Jun 10 08:57:28 2014   by   Torben
Your idea is fine, though you can shorten choose(1) to 1 and choose(0) to 0.  What goes wrong in the second case is that 2z5 means two individual z5s rather than the sum of the two.  So the condition d2 > 2z5 is true if the d2 is greater than any of the two z5s.  To get what you want, you should write if d2 > sum 2z5 then 1 else 0.
 
Wed Jun 11 07:49:27 2014   by   Foxiekins
Ah, that was the bit I didn't understand...  sum 2z5 instead of 2z5...  Thanks...
 
Mon Jun 16 05:06:12 2014   by   Foxiekins
Ran into a bit more of a snag.  If I understand correctly, d12+d10 should be a single value, like the roll of one die.  But, when I have d12+d10 on one side of the condition, I get the error "Distribution error: Singleton expected at line 1, column 6."  When I try sum (d12,d10), I get the error "Parse-error at line 1, column 11."  And when I try sum (d12 U d10), I get the error "Distribution error: Non-singleton used with > at line 1, column 19."  I am at a loss for how to have more than one die in place of the d2 in the original comparison.
 
Mon Jun 16 09:43:51 2014   by   Torben
Try writing (d12+d10) instead.  You have probably run into a peculiarity of Troll: Comparison operators bind stronger than arithmetic so, for example, d6 < d8 + d10 reads as (d6 < d8) + d10, which gives an error if the result on the d6 is not smaller than the result of the d8 (and, in any case, is probably not what you meant),
 

Return to topic list



New message:
Topic:
Posted by:

Type the values of the dice shown below:

Return to topic list