I'm in the process of writing a dice rolling program for my D&D group (as well, I think I've hit Critical Nerd Capacity from this), and I've run into and issue. My friend gave me the idea of an optional "luck value" that essentially boosts the rolls real high. There are a few lines of code that prevent the luck value from pushing the roll over what it could possibly be without it, and here I run into a problem. There's an option in the program to roll like 4 dice at a time and have it display all of them. I made this display as a matrix with varying size, though always (#)x1. I want to add a luck value to that. I've already figured out how to do that, namely using seq and list▶matr. The real problem is evaluating the truth of the luck value checking statement. I've set it to check if one matrix is less than another, but the problem is that [1 2]<[2 3] displays [true true], not true. As well, in practice the truth of the matrix may very well be something like [true true false true false]. Is there any way to 1. evaluate the truth of matrices like that and 2. a way to apply a function to a matrix of varying size to only a certain boolean value inside?
http: // paste bin. com/ tdYEuxEt Lines 146 to 156 is the issue.
For those who know D&D terms, the luck value is (gdx+n)+(1/2)*x*g-g+1, ex. (1d8+3)+1/2*1*8-1+1=(1d8+3)+4, and if that pushes it over 11 (the max of 1d8+3) then it displays the original roll.
I honestly have no idea if this is even possible, but it's worth a shot, eh? It'd be easy if the matrix size wasn't variable.