Return to topic list

Wed Nov 10 12:00:00 2010   by   Torben

As you will have noticed, this page of news and comments have been added to the Troll dice roller page. I will use the news page to announce new developments and features to Troll. New entries will be added at the top of the page.

I will start by mentioning a few changes that I have (silently) made over the last few months.

As some of you may have noticed, the Troll the dice! button has been replaced by two separate buttons for rolling dice and calculating probabilities. Additionally, you can now specify how many digits of precision you want shown for the probabilities and you can choose if the second column shows the probability of the result being ≥, ≤, > or < than the value shown. The first column and the graph will always show the probability of the result being equal to the shown value.

Another change involves the Troll language itself. ?p, where p is a probability written as a 0 followed by a decimal point and at least one digit (e.g., 0.141592) will return 1 with probability p and the empty collection with probability 1-p. It is usually combined with if-then-else, such as in if ?0.312 then 7 else 9, which will choose 7 with probability 0.312 and 9 otherwise. The ? operation allows choice with arbitrary probabilities, where the previous operations (such as choose only allows choice with uniform probability.

Tue Nov 23 12:00:00 2010   by   Torben

An earlier attempt at optimisation introduced some bugs. I thought I had fixed them, but one remained for foreach which means that use of an assigned variable inside foreach sometimes gave wrong probabilities. This is fixed now.

If you have made any probability calculations using foreach in the last couple of months, you should probably redo them to be sure you get the right result.

Mon Feb 21 12:00:00 2011   by   Torben
Some spammers have misused the possibility of saving user-defined definitions to post spam. Hence, I have disabled this option until I find a solution, which might be a login procedure or moderation. I will post here when this happens.
Tue Feb 22 12:00:00 2011   by   Torben
In hope that the spamming was done by a script rather than a human being, I have added a rather simple-minded fix: If you wish to save a definition, the description must start with a backslash and a space, e.g., "\ my roll". This should foil most scripts but allow humans to use the option. If the spam reappears, I will add stronger measures.
Fri Jun 3 12:00:00 2011   by   Torben

I have added two new operators: minimal and maximal. They are similar to min and max, but where min returns a single copy of the minimal value, minimal returns all minimal values. For example, min{2,2,3} returns 2 but minimal{2,2,3} returns 2 2. Similarly, maximal returns all maximal values. Note that minimal and maximal, unlike min and max, are defined on empty collections, where they return the empty collection.

Tue Jun 7 12:00:00 2011   by   Torben

The probability calculator now allows text operations when calculating probabilities. Beware that this will list all possible strings that can be generated, so don't use it for, for example, the d20 character definition, as that can generate 176=24137569 different strings.

It is, however useful if you want to return two independent values (such as width and height of a roll), as you can return the pair of x and y by writing.

 "(" || 'x || "," || 'y || ")" 
Fri Jun 10 12:00:00 2011   by   Torben

A recently made over-eager optimization made some expressions like d6-d6 generate wrong probability distributions. It is fixed now.

Wed Jul 6 16:31:09 2011   by   Torben
As you will have noticed if you read this, I have extended the news feature to a forum where you can add comments and ask questions. It is still somewhat in beta, so if you observe odd behaviour, please send me a mail at

Please don't misuse this option. If spambots get to the forums, I will add a simple form of captcha and if this doesn't help I will add a login requirement.
Wed Aug 31 10:43:32 2011   by   Torben
Some spam got into the forums.  I deleted it, but if it happens again, I will add a CAPTCHA or something similar.
Mon Sep 12 17:06:56 2011   by   Torben
Spam robots hit the forums again this weekend, so I have added a simple CAPTCHA: Four dice are shown below the input area. To post, you must type the values of these (without spaces) in the field to the left of the Post button.
Wed Oct 5 11:40:36 2011   by   Torben
Due to a power outage Troll was down today from around midnight to 11 AM.  I apologize for the inconvenience.
Fri Nov 4 12:38:55 2011   by   Torben
I have added a preview option to postings, so you can check the formatting of yourtext before posting.

Just use the Preview button to the right of the Post button.  You don't have to type the dice values, but you do need a topic and a name.
Mon Nov 14 16:42:29 2011   by   Torben
I have added a keep operator to the Troll language. x keep y keeps the elements in x that are also found in y.  For example,

(sum 3d6) keep (5..15)

adds 3 d6 and keeps it only if the sum is between 5 and 15 (returning the empty collection otherwise).
Mon Nov 14 16:49:27 2011   by   Torben
Some user-contributed definitions got lost in the upgrade due to me stupidly overwriting the newest copy with an older copy.  I apologize for the inconvenience.
Sun Nov 27 11:11:43 2011   by   cxcvi
Do you know if the keep operator will be added to the MosML version?
Mon Nov 28 10:31:31 2011   by   Torben
It is added.  I just forgot to edit the "last update" date.
Thu Mar 15 11:08:25 2012   by   Torben
If you have posted, you might have noted that it can take several tries to get through the CAPTCHA.  This was because I had accidentally categorised some dice showing "6" as "8", so if there were 6s among the shown dice, you were likely to not get through even though you typed correctly.  This is fixed now.
Wed Mar 28 10:39:16 2012   by   Torben
I have added an option to change the bound on loop iterations and recursion from the default 12.  If you increase the bound, you will increase precision of probability calculation for rolls that use the accumulate loop or function calls, but the time to compute probabilities also increase (so you risk getting over the limit set by the server).  The iteration bound does not affect random rolls.
Tue Jun 5 12:43:43 2012   by   Torben
The Troll webservice has been down for about a week due to problems when the server was moved.  I apologize for the inconvenience.
Fri Jun 22 14:37:26 2012   by   Torben
I have made two minor additions to Troll:

One is the -- operator, which is multiset subtraction.  This differs from the drop operator by only dropping as many instances of value as the number of occurrences of the value in the second argument,  So while {2,2,2,3} drop {2,5} returns {3}, {2,2,2,3} -- {2,5} returns {2,2,3}.

The other addition regards the compositional construction for declaring compositional (homomorphic) functions.  Where it was previously only allowed to use user-defined functions for the second and third argument, it is now possible to use predefined operators, so the product function can now be defined as

compositional product (1,sum,*)

In other news, the Troll server was down earlier today and last night due to a server move, but it is up and running again now.
Mon Dec 10 11:13:36 2012   by   18d6 discard values at or below 75
How do i make "18d6 discard values at or below 75"
Tue Dec 11 14:26:43 2012   by   Torben
For example by

75 < sum 18d6

This will simply discard any roll below or equal to 75, returning nothing.  If you want to reroll until the result is greater than 75, you can do it by

repeat x := sum 18d6 until x > 75
Thu Feb 14 16:42:57 2013   by   Torben
I have added a median operator with the obvious meaning.  This means that, where you earlier had to write, for example,

max least 2 3d20

you can now write just

median 3d20

Using median on a collection with an even number of values will choose the higher of the two middle values.

The median operator is optimised for common cases like the above, but works (albeit sometimes slowly) in any context.
Wed Jun 12 17:33:51 2013   by   Torben
The offline version of Troll now has added options for selecting <, <=, > or >= for the second column of probabilities (like in the online version).  See the manual for details.
Fri Sep 13 11:49:11 2013   by   Torben
The server crashed sometime between yesterday and today, but it is up and running again now after a reboot.
Mon Sep 16 08:21:05 2013   by   Foxiekins
I've been trying to code a new roll, and keep getting parsing errors...

I'd like to set Ability and Difficulty...
Roll a number of d6 = Ability + Difficulty...
A 6 is always a success; 2 - 5 are successes if they are larger than the Difficulty...
Net Successes = number of successes - Difficulty...
If Net Successes is positive, the roll hits...
If Net Successes is zero, the roll misses...
If Net Successes is negative, the roll fumbles...

The number of positive or negative Net Successes is also important...

How would you code this...?  Like I said, I've tried, but keep coming up with parsing errors over and over...
Tue Sep 17 11:29:35 2013   by   Torben
If I understand correctly what you want to do, you might do it something like this:

ab := 4;  \ ability
di := 3;  \ difficulty
(count (min {di,5}) < (ab+di)#d6) - di

The min {di,5} part ensure that 6s always count as successes.
Thu Nov 21 15:37:30 2013   by   Torben
I have now added the mod (division remainder) operator.  Like *, /, etc. it works on two single numbers.

I have also fixed a minor bug in the parsing of function definitions.  You are unlikely to have been affected by this, but if you want to be sure, rerun your definitions in the new version.
Wed Mar 19 17:32:57 2014   by   Torben
In the planet-map generator, the "adjust colour by latitude" checkbox has been replaced by more options, so icecaps can be made larger.  The "Yes" option is like the previous checkbox and the "strongly" and "very strongly" options make ice caps larger.
Thu Apr 3 15:36:51 2014   by   Torben
For Troll, I have added an option of specifying a probability multiplier other than 100, so you can get your probabilities in something other than percents.  If you specify 1, you get mathematical probabilities (ranging from 0 to 1) and if you specify, say, 216, you multiply these probabilities by 216.  This can be used to get the probabilities as fractions if you know the divisor.  For sum 3d6, max 3d6 and similar rolls, there are 63 combinations, so using 216 = 63 as multiplier gives you clean fractions.

For more complex rolls, it can be difficult or impossible to find a good multiplier, so I suggest you use percentages or mathematical probabilities for these.
Tue May 13 17:16:45 2014   by   Torben
I have added a few more colourmap options: Bathymetric imitates a colouring used in some atlases, Black body radiation imitates black-body radiation (heat maps) and Greyscale uses shades of grey to display altitude.

Additionally, I have added an option to apply a non-linear scaling to altitude.  This makes land flatter near sea level.  IMO, this makes maps a bit less unrealistic.
Wed May 14 10:38:15 2014   by   Torben
I have compiled the newest version of the planet program (May 13 2014) for Windows.  It has been tested on Windows 7 and Wine (a Windows emulator for Linux).  You can download the program at
Wed May 21 12:34:44 2014   by   Torben
Troll and the planet map generator have now migrated to another server, using the same URL.  You should not see much difference, except:

1. Exceeding the time limit in Troll now shows a more readable error message.
2. There is now an option to make Troll mail the result to a mail address.  Please do not misuse this option.

If you notice any problems, please let me know.
Thu Nov 6 11:38:20 2014   by   Torben
I have changed the way Troll outputs text strings in generated values.  This now allows simple HTML tags in strings such as "<font color=red>Red text</font>", which will show as red text.  Note that attributes should not be quoted, as that will terminate the string.
Tue Nov 11 13:38:33 2014   by   Torben
I have uploaded a new version of the planet generator to the Planet home page.  It has two changes:

1. An extra colour map "OlssonLight.col" which is a lighter variant of Olsson.col has been added.  This affects both the web interface and the offline program.

2. The heightfield option (only available in the offline program) has been changed: Rather than being a projection option it is now an output-format option.  This means that you can get heightfields with all projections.  Heightfields are indicated with the "-H" option, so "-H -pM" will give you a heightfield of a Mollweide projection.  The old "-ph" option is still suported, but I recommend that you use the equivalent "-H -po" options instead.
Wed Nov 12 03:35:18 2014   by   Ron Vantreese
Bug report: Affects Windows.

Test sample: planet -w 799 -h 399 -c -pq -C Lefebvre2.col > p20141111.bmp

The result is not working well. Image is corrupt, even though there's nothing wrong with Lefebvre2.col (or any of the *.col files).

Work-around: planet -w 799 -h 399 -c -pq -C Lefebvre2.col -o p20141111a.bmp

This works better.

Wed Nov 12 11:27:07 2014   by   Torben
The problem with Windows is solved now.  The problem was that Windows converts LF to CR,LC in standard output unless you change it to use binary mode.  Doing this is DOS/Windows specific, so I had to add some #ifdefs to make it work.

I have tested it only with the Tiny C compiler for Windows.
Sat Dec 6 06:15:06 2014   by   Ron Vantreese
New GUI Planet Generator VPPlanetGenerator_ 1_ 2_ 15066_ 20 is released. It's located at!30215

A new rendering engine (NetPBM Crater Generator) is included.

The Mogensen Planet Generator supports the new option provided by Torben in planet.exe: Wrinkly Contours and Height Fields. The Height Fields produce a Matrix grid of numbers. Clicking on the upper-left corner provides opportunity to copy the numbers to the Clipboard.

Regarding the Matrix of numbers, I welcome suggestions, as I kind of guessed what to do with it. There is currently no button to save the Matrix, but you can copy to clipboard and paste it to a text file.
Mon Feb 23 15:52:37 2015   by   Torben
The Windows-executable on the homepage had incorrect file permissions, which prevented download.  It is fixed now, so if you have tried to download it in the last couple of months and failed, please try again now.
Mon Jun 1 12:21:27 2015   by   Torben
The server that hosts Troll and the Planet generator has been down about a week, but the problem seems to be resolved now.  In any case, I apologize for the inconvenience.
Fri Jun 12 16:28:05 2015   by   Torben
I have made two changes to Troll:

1. I have added ordered pairs (as opposed to unordered collections) as possible values.  While you can have pairs of collections, you can, however, not have collections of pairs (just like you can't have collections of texts).  I have added a simple example to the left drop-down list.

2. I have added some optimisations that can make probability calculations a lot faster for some definitions that use bindings (i.e., the := operator).
Tue Jun 30 13:53:03 2015   by   Torben
I fixed a bug for the minimal operator when making random samples.

The bug would make the expression minimal 1 return the empty set instead of 1.

Probability calculations wre not affected by the bug.
Tue Jun 30 22:29:06 2015   by   Ron Vantreese
Is this (minimal 1) a fix for planet or troll?
Wed Jul 1 09:02:49 2015   by   Torben
For Troll.
Wed Jul 8 16:20:33 2015   by   Torben
I fixed a bug in Troll where a range expression such as 4..3 would generate an error instead of an empty collection.
Thu Jan 7 11:25:51 2016   by   Torben
I have added an operator sgn that finds the sign of a number.  The sign is represented as -1 for negative numbers, 0 for zero and 1 for positive numbers.

This is useful if you just want to figure out if a result is a win, a tie or a loss.
Wed Oct 18 10:13:25 2017   by   Torben
It is now possible to access Troll and the planet generator using the https (secure) protocol.  For security reasons, I suggest you change your bookmarks to use https.
Mon Jan 29 15:12:46 2018   by   Torben
A CAPTCHA has been added to the Troll page for the "send email" option.  This is to prevent this feature being misused by scripts for spam.
Fri Mar 16 09:50:47 2018   by   Torben
There was a server breakdown yesterday which made both Troll and the planet generator unavailable.  We apologize for the inconvenience.
Tue Apr 3 11:39:43 2018   by   Torben
A bug has been fixed in Troll, where n..n would return the empty set when calculating probabilities.  n..m where n is different from m was not affected by the bug.
Thu Oct 29 16:13:46 2020   by   Big Fan
Have been a fan of troll back since it was first established, and still use it today. Love how deep and incredible the functionality it, and how you keep tweaking it to make it better and better.

This is a long-shot question; but is there a way to have it represent the outputs of a probabilities calculation as fractional values instead of decimals?

I realize that it might be a good bit of difficult work to get that to happen. So far I've been using variations of the multiplier values; which works well for functions and dice pools that behave well

BUT: for things like the Savage World die pools; I know they settle down to nested fractions, but haven't found a good way to decode them back into them.

Thanks again for all the hard work and such a quick and handy product!! :)
Fri Oct 30 09:39:18 2020   by   Torben
You can sort of display as fractions, but you have to specify the denominator of the fraction.  For example, for sum 3d6 you can specify 216 (= 6*6*6) as the multiplier, and then it will display the probabilities as 1, 3, 6, 10, ...,
representing 1/216, 3/216, 6/216, 10/216 and so on.  For some dice-rolls it is, however, near impossible to find a common denominator, so I haven't made the program automatically find one.  And for exploding rolls, as in Savage Worlds, there is no finite denominator.
Mon Nov 2 01:50:45 2020   by   Big Fan
The method you describe is what I've been using thus far with marginal success.

For exploding dice like in SW the fractional multiplier is "usually" some variation on (Ax)*(By)*(Cz) where A,B,&C are the dice-types [D8] and X,Y,&Z are the number of times that-sided die needs to explode to hit the number in question.

Its not foolproof but its a good starting point. I MUCH prefer a fraction to give the exact number when I can find one [ie: 136747/10077696 instead of 0.01356927218]. No loss to rounding or truncation, and gives me a better feel for the patterns and whats going on. Unfortunately the exponents quickly grow beyond the fraction input buffer length, despite its generous size.

One related operational question. If I wanted to sum one of each exploding die type; is there any benefit (in processing time or precision, etc) from putting the "accumulate" statements in an order (either ascending or descending), or will it preform identical with any/all orders?

Thanks again; and minor apologies for accidentally posting my initial question under "news". Please feel free to move and/or modify it as appropriate.
Mon Nov 2 10:27:53 2020   by   Torben
Behind the scenes, Troll uses floating point numbers, so it is not always easy to find a fraction.  I once tried to modify Troll to use exact fractions, but they quickly exploded so the involved integer calculations overflowed, even if I reduced the fractions aggressively. It also made the calculations much slower, so I dropped this again.

As for ordering the accumulates, I'm not sure I get what you mean.  Could you provide an example?
Wed Nov 4 04:00:34 2020   by   Big Fan
A) maxing the precision and iterations while "intuitively" using the fraction/multiplier let me find out that chances of getting a 13,14,15,&16 on an SW:D8 (max of exploding D6 & D8) are EXACTLY 271,273,275,&63 each over 13824 which is 62 * 83. 17&18 are 719&215 over 63 * 83. When I have those fractions, I can lessen any rounding or truncation errors from whatever I may be doing with them.

B) The following roll setup shows the max of 7 different size exploding dice (one per line). I could swap the 3rd and 4th lines without changing the results.
Does troll work any "better" with the dice ordered in any particular way (ascending v/s descending v/s random or other). A mostly meta/power-question

max { sum (accumulate x:=d4 while x=4),
      sum (accumulate x:=d6 while x=6),
      sum (accumulate x:=d8 while x=8),
      sum (accumulate x:=d10 while x=10),
      sum (accumulate x:=d12 while x=12),
      sum (accumulate x:=d16 while x=16),
      sum (accumulate y:=d20 while y=20) }

C) is there any better way of getting through the long list of user saved rolls?
Wed Nov 4 11:04:07 2020   by   Torben
A) Nice.

B) In the example you show, it is slightly faster (about 25%) if you list the largest dice first.  But the computation time is in both cases only around 0.1s, so when using the web page, this is dwarfed by transmission time and so on.

C) Not at the moment. I might add a search function someday.
Mon Mar 15 11:10:35 2021   by   Torben
I fixed a bug in the planet generator, where the longitudes in the icosahedral projection were wrong.
Fri Jul 21 11:27:48 2023   by   Torben
The domain has been down a couple of weeks in July, making both Troll and the planet generator unavailable.  I won't bore you with the details (which were out of my control), but, as is evidenced by this posting, things work again.
Tue Sep 26 11:37:30 2023   by   Torben
I have fixed a few bugs in the planet generator:

- The colour interpolation was slightly off.
- For magnification/zoom less than 1.0, some projections (stereographic, gnomonic, conical) gave low detail for off-center areas.

The webpage and download site have been updated to the new version.
Fri Sep 29 14:10:09 2023   by   Riviera71
Hi Torben,

Good job, in c source code line 5, the  year version is not good.

Best regards,

Mon Oct 2 10:40:45 2023   by   Torben
Sun Oct 15 17:28:11 2023   by   Mizuki
I want to say I managed to merge in Riviera71's projection and made a whole bunch of QoL features:
- Better version information - the program will exit after printing it (-R)
- Better progress - I repurposed the -X debug code as a progress indicator.
>planetmod.exe -o 1.bmp

The file is located here:

Also I want to ask - is it fine to remove all the declared-but-unused variables?
There are like 20 of them scattered around, do you use them for anything?
Mon Oct 16 11:10:06 2023   by   Torben
You can remove unused variables, no problem.  They are leftovers of earlier versions. In the latest revision removed a few variables that were declared and calculated, but never really used for anything.
Tue Oct 17 19:06:58 2023   by   BatteryMaster
Would it be possible to add a feature that generates seeds based on the closest similarity to the current seed? I'm trying to recover a seed I generated and lost back in 2022, and something like that would help narrow down the results.
Wed Oct 18 04:25:12 2023   by   Mizuki
If you still have the original map I suggest creating a .map file approximating your old map. (See section 3.2 of the manual)
Wed Oct 18 04:26:38 2023   by   Mizuki
also if you have the original .bmp/xpm/ppm then the seed is located in the file itself (open the image in notepad++ or something)

Return to topic list

New message:
Posted by:

Type the values of the dice shown below:

Return to topic list