I am writing a code that will roll dice as if you are playing Risk. Then it tells you how many casualties there are. I almost completed it once, but after trying to debug it, it got so messy and messed up that I started over. This is my code so far:

C D and E all are set to a random number, 1-6, like it should. But F and G are displayed as 0. I even put an If statement there, so if it is equal to 0 it should go back to ":Disp F", but it didn't loop, it just displayed 0.

Any idea why?
And any tips on the rest of the code would be cool.

"Give a man a fish and he will eat for a day; teach a man to fish and he will eat for a lifetime; give a man religion and he will die praying for a fish." - Anonymous

WAY 1
instead of using "if" statements to decide when to stop the program…it is possible to use the randint function whereby
randint(1,6,A) will generate A number of random integers from 1 to 6

it will be displayed in a {int 1, int 2, int 3,…} format, should you want to display it in LINE BY LINE, you can then use randint(1,6,A)->L1…then:
Disp L1(1)
Disp L1(2)
Disp L1(3)

the same can be done for B, just dat the function is now randint(1,6,B) and that you display only UP TO L1(2)

WAY 2 AND ALSO THE MORE EXCITING BUT SLIGHTLY MORE COMPLEX WAY
I THINK THE BIGGEST IRONY IN THIS PROGRAM IS THAT…while it may be assumed that when a 0 is shown…it just means that no dice is being rolled for that time…however, it is ironic to output "ATTACKER ROLLS" before a 0 given that the Attacker does not fundamentally roll a 0 at all

IT IS THUS POSSIBLE TO OUTPUT ONLY THE DIGITS THAT ARE BEING RANDOMLY GENERATED, AND NOT 0…

CONCEPT:
the concept is that you are actually outputing all the 3 (C,D,E) variables for A and all the 2 variables (F,G) for B…HOWEVER, YOU CAN MAKE THE ZERO DIGITS DISAPPEAR!!!! this is by outputing a blank space after outputing the digits such that the blank space covers up all the 0 digits that are not randomly generated

:Lbl Q
:randint(1,6,5)->L1
\\it thus does not matter how many attack or defend dice is being INPUTED by the user…you just randomly generate 5 regardless of what and THEN DECIDE HOW MANY TO OUTPUT / DISPLAY
:ClrHome
:Output(4,1,"ATTACKER ROLLS")
:Output(5,1,L1(1))
:Output(6,1,L1(2))
:Output(7,1,L1(3))
\\there is no need to compute the deleter sequence for the first digit, since A must definitely be at least 1
:Output(6,2-abs(int(A-2.5))," ")
\\IF A IS 2 OR 3, THE HORIZONTAL VALUE WILL BE 2-0=2, the blank space is thus outputed at (6,2) and thus does not cover the SINGLE DIGIT random interger at the placeholder for the 2nd integer
\\IF A is 1, HORIZONTAL VALUE WILL BE 2-1=1, the blank space is thus at (5,1) and thus "covers" the SINGLE DIGIT random integer at the placeholder for the 2nd integer…nothing is thus displayed on the screen as opposed to 0 (since it is imprecise to say that 0 is being rolled by the ATTACKER DICE)
:Output(7,2-(abs(int(A-1.5))-1)," ")
:ClrHome
:Output(4,1,"DEFENDER ROLLS")
:Output(5,1,L1(4))
:Output(6,1,L1(5))
\\B's digits can be coded for by 4th and 5th element of the same list as A, L1
:Output(6,2-abs(int(A-2.5),L1(5))

WHOALA…I believe this to be perhaps neater and hopefully more concise and innovative and less tiring to code for, especially if you are planning to expand your program to handle a larger number of random integers or a larger number of players

ALL THE BEST TO YOUR PROGRAM!!! …=) =) =)

p.s. PLS DO CHECK MY PARENTHESIS…I DUN TINK THERE SHUD BE AN ERROR…BUT TEND TO BE CARELESS AT TIMES…=)

In TI-BASIC, you do not need ending parentheses because the newline acts like all the ending parentheses and quotation marks that you need. Also, I am not even sure what this code does, but here is a way to optimise your code:

Thanks for the input! The program that i wrote above is an optimisation of the Risk game program that dagav posted =)…the modifications still allow the script to do what it was intended to, except for one line that you wrote (ref. below)

:Repeat B≤0 or B≥3

cos if B does not fall within this range, then your Repeat function will let it repeat running of the program again, starting from the prompt for variable A…
However, my intention was actually dat if B does not fall within the satisfied range…then it ONLY prompts for B again, as opposed to starting all over again with the prompt for A…since for the program to prompt for B, it means that it has already approved A's value

Lol, as in when i was talking about parenthesis…i was referring to the parenthesis of the "abs" and 'int" function, beacuse if the closing parenthesis is placed wrongly, it might then affect the horizontal coordinate of the output

but i tink there might be an error prior to dat…or else a change in the reading sequence of the commands, cos he reported that he saw a "0"…however, if Lbl0 is the first bug that appears, den his program shud have been terminated with a ERR:LABEL and not be able to display any value at all