Reroll using d10 and Highest of pool

## Reroll using d10 and Highest of pool

 Tue Nov 29 20:57:28 2016   by   Tyghorn Hello.Fantastic Tool, congratulations to the creator.I'm having difficulty to create a reroll system, if possible i would like some help with that.The system i'm testing uses d10 only. The Basic roll is K+2d10+Y, where 'K' is a number of extra d10's the character may receive for high attributes and 'Y' is a bonus or penalty the character may receive for high or low skills. The player keeps the 2 highest dice.The problem is, i'm trying to compare some dice rolls with and without rerolls of 1's. For example, i would like to compare 4d10 with 3d10 rerolling 1's. What kind of functions and commands should i use to create the this reroll system?I'm currently using the command bellow to test the basic roll without reroll:    sum largest 2 Kd10+Y Wed Nov 30 10:04:22 2016   by   Torben The basic rolls seems fine, if K is the number of dice (in the explanation you say there are K+2 dice).I'm not sure what you mean by rerolling 1s.  Are you removing the 1 and rolling another die, or are you adding an extra die for every 1 rolled?  And do you do this repeatedly if the new dice are also 1s, or do you stop after one reroll?If you replace 1s by new dice and continue doing so until there are no ones, you are in effect rolling dice that are labelled 2 to 10.  You can do this by writing  `sum largest 2 K#(d9+1) + Y`Or, equivalently  `sum largest 2 Kd9 + Y+2`since adding one to every die corresponds to adding one two the two largest that are selected and added.If you add new dice for every 1 rolled and continue doing this (exploding rolls), you can do it by    `sum largest 2 K#(sum accumulate x:=d10 while x=1) + Y`I assume the 1s are added to the rerolled dice, so you can get values over 10 (and sums over 20).If you replace 1s with new dice, but only once, you can do it by    `sum largest 2 K#(x := d10; if x=1 then d10 else x) + Y`If you add a new d10 for every 1, but once only, you can do it by    `sum largest 2 K#(x := d10; if x=1 then 1+d10 else x) + Y`I hope this helps. Wed Nov 30 11:57:51 2016   by   Tyghorn Sorry, lacked a better explanation.It was the first case, when you roll a 1, you get a reroll by replacing that 1 until there is no dice with that value.Such a simple method, it totally slipped through me. It helped a lot Torben, Thank you so much.