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.

Return to topic list

New message:
Posted by:

Type the values of the dice shown below:

Return to topic list