3d6, reroll lowest, but only if total is under 9

3d6, reroll lowest, but only if total is under 9

Return to topic list

Fri Dec 8 08:43:01 2017   by   BaconCatBug
So the code for 3D6 reroll lowest is trivial, it's "sum {d6,largest 2 3d6}" because you're always re-rolling the lowest even if it's a 6.

However, I want to have a code that only re-rolls the lowest if the total of the original 3D6 is under 9. I have literally no idea how I would go about it.

If someone could point me in the right direction I'd appreciate it.
 
Fri Dec 8 10:28:47 2017   by   Torben
You can do it this way:

x := 3d6;
if (sum x)<9 then sum {largest 2 x; d6} else sum x
 
Fri Dec 8 10:35:15 2017   by   BaconCatBug
Thank you! You are super awesome and the world is a better place for your work!
 
Fri Dec 8 10:36:30 2017   by   BaconCatBug
Welp, was a little premature there, I am getting an error

Parse-error at line 2, column 35
 
Fri Dec 8 10:38:18 2017   by   BaconCatBug
Welp, was a little premature there, I am getting an error

Parse-error at line 2, column 35
 
Fri Dec 8 10:50:46 2017   by   BaconCatBug
Epic Quads!

Turns out all I had to do was RTFM and change the errored ; into a ,

Thank you again for the help!
 
Fri Dec 8 16:17:47 2017   by   Torben
Yes, sorry about the typo.  I should have tested the code.
 

Return to topic list



New message:
Topic:
Posted by:

Type the values of the dice shown below:

Return to topic list