I have written a chunk of code to try to roll dice and then count up hits for a game called Axis & Allies, where you have to roll less than or equal to a certain number to land a hit with each die. When you get large numbers of dice, this becomes painful to keep track of, so I wanted to make a program to roll the dice and count the hits for me. I have the first parts of the code more or less written, after an earlier failed attempt where I couldn't get a list produced by randInt(1,6,F) to check for ≤ because of data type errors:
:0->G
:0->N
:0->U
:0->E
:0->P
:Disp "ENTER UNITS:
:Prompt F, T, D, O
:Disp "FOURS:
:Repeat G=F
:If F
:Then
:Disp randInt(1,6)
:If Ans≤4
:(N+1)->N
:G+1->G
:End
:End
/ / So on and so forth with threes, deuces (because two starts with T and so does three), and ones
:Disp "HITS:
:Disp N
:Pause
However, for some reason my hits don't seem to be all that directly correlated to what randInt(1,6) displays, despite the Ans≤4 clause. Is Ans≤4 causing a new randInt(1,6) to be tested for ≤4 instead of the result of the already-displayed randInt(1,6)? Is my repeat not quite right? There aren't any error messages or anything, but it's not doing what I want it to and I can't figure out why. I'd be thankful for any advice anybody could give me.