Life Beyond Dice

Wargaming and BASIC Programming

by James P. Werbaneth, Gibsonia, Pennsylvania

Wargaming and dice go together like blitzkrieg and armor. But familiarity breeds contempt, and some players don't like or trust their dice. Sometimes it's because of a run of bad luck; many times I've been tempted to round up all the dice I can find and melt them down into a big, ugly blob. I have my reasons. For example, take Napoleon's Last Battles (SPI/TSR) and The Siege of Jerusalem (Avalon Hill).

In the former one is good and six bad, whereas in the latter six kills, and one disappoints. Yet there are dice out there that insist on giving me a whole lot of sixes in Napoleon's Last Battles, but hold out on me when it comes to The Siege of Jerusalem. Then the number one is a constant companion, sent to mock me and contaminate my precious bodily fluids. All the paranoids are out to get me!

Calm down. It's not all of them. Just the dice. They watch me when I sleep, then get back in the box when I wake up. I'm going to have to buy an axe. That's what the voices say. See what a long string of bad die rolls can do? Some gamers search for substitutes. One I know bought a little electronic fortune-telling cube at Radio Shack. Conveniently, it had six answers to questions, so it was easy to assign a number to each. But he gave up on this, since it was more than faintly ludicrous to jump up and down yelling, "Aha! It says 'Ask some other time!' That's one, so I win!" It was even worse when I threatened to throw it out in the driveway for repeatedly telling me "I see changes ahead," the equivalent of the hated (in that game) number six.

Another I know has an acquaintance who plays Dungeons & Dragons with his children. To keep them interested, he built a similar device he called a dragon's bone. It was supposed to look like a big green bone, with lights flashing randomly all over it. When the player turned off a switch, the lights stayed lit, next to corresponding numbers. It worked very well, until my friend borrowed it for a real wargame. When he gave it back, the lights no longer flashed with their old randomness; they always seemed to land on bad numbers. As men of science, my friend and the bone's owner had no choice but to conclude that it was ruined by prolonged exposure to my friend's bad karma. I understand an exorcist has been consulted, but said fixing it was hopeless.

Faced with the plot of the dice, in which the spirits inside the dragon bone were obviously co-conspirators, I repaired to my basement laboratory. This is the place where I design wargames, and occasionally other new lifeforms with bad manners and blasphemous appearance (more on that some other time). I took an aged grimoire... uh... I mean slightly worn computer manual... and set to work.

The result is random number generator in BASIC computer language. I chose BASIC as the medium of my creation because BASICA, GW-BASIC, and all of their relatives are available to millions of computer users worldwide, on a vast range of machines. It would be easy for them to punch in the code for my program and duplicate it for their own benefit. Besides, I didn't have a lot of choice. BASIC is the only language in which I can program. It's a menu-driven program, producing nine types of die rolls on demand:

Six-Sided Die-----This is the most familiar, and the one used by the overwhelming majority of games.

Sum of Two Six-Sided Dice-----The second most common, used most prominently in Avalon Hill's Squad Leader and Advanced Squad Leader. To maintain a proper distribution of results, the program does not randomly generate a number from two through twelve, instead taking two six-sided "rolls", and adding them together.

Two Six-Sided Dice in Series-----This takes two dice, in which one is read as "tens" and other as "ones," yielding a base-six result from 11 through 66. It is most useful for older naval games, such as Bismarck '77 (Avalon Hill) and Submarine (Battleline/Avalon Hill)

Ten-Sided Die (0=10)-----The future of wargaming is the replacement of the six-sided die with ten-sided ones. This replicates such a roll, yielding a result from 1 through 10. It is useful for a wide range of GMT games, among others.

Ten-Sided Die (0=0)-----Basically the same thing, only zero stays zero, and so the range of results is 0 through 9. One use is resolving combat in Firepower (Avalon Hill).

Sum of Two Ten-Sided Dice (0=10)-----Giving results from 2 through 20, its only use as far as I know is in Arctic Storm (GMT).

Sum of two Ten-Sided Dice (0=0)-----So far, I know of no game that calls for this, but in case one does in the future, it's in the program.

Decimal Dice (1-100)-----This gives the greatest and best range of results in wargaming. Among the titles using it are Avalon Hill's MBT and IDF modern tactical games.

Decimal Dice (0-99)-----Aficionados of The Royal Navy (Quarterdeck) would find this one useful.

As an added attraction, the random number generator has an option for use in play by mail. As it's used, it generates a hard copy of each die roll. This includes the result, its type, and there is space open for the player to write in possible modifiers and a final result. Furthermore, the printout identifies each die roll in the order of resolution, so that it can be readily applied. Finally, for additional clarity and verification, it identifies the player, the game being played, date of use, and time the program is started and ended.

Of course it's not all that hard for an unscrupulous player to circumvent these security measures. But if someone's that determined to cheat in a friendly wargame, then chances are they've got a lot of much worse and deeper problems. As stated above, this program can be duplicated by anyone owning a BASIC computer language. It has only a hundred and sixteen lines, though users can cut this down still further by eliminating die roll types that they don't need, explanatory text, or the entire play by mail component. However, major modifications are recommended for experienced BASIC programmers only. So, for everybody who gets so mad at dice that the little dots turn into staring, hostile eyes, here's a method of resolving combat, and calming a disturbed mind. For the better-adjusted people, it's good instruction in how governments and military establishments really work. How come? It manages it replace a couple of twenty-five cent dice with at least a thousand dollars of computer equipment. Do it, and feel just like a bureaucrat.

PROGRAM CODE

10 RANDOMIZE TIMER
20 KEY OFF
30 COLOR 7,4,4
40 CLS
50 DEFINT A-Z
60 PRINT: PRINT: PRINT "WARGAME RANDOMIZER PROGRAM": PRINT: PRINT "THE PURPOSE OF THIS PROGRAM IS TO PROVIDE, WITHOUT DICE, RANDOMIZED NUMBERS": PRINT "FOR COMBAT RESOLUTION AND OTHER PURPOSES IN WARGAMES. A WIDE RANGE OF 'DIE"
70 PRINT "ROLLS' IS AVAILABLE, SUBSTITUTING FOR SIX-SIDED AND TEN-SIDED DICE, IN": PRINT "VARYING COMBINATIONS.": PRINT: PRINT "IN ADDITION, THERE IS AN OPTION TO GENERATE": PRINT "A HARD-COPY PRINTOUT, RECOMMENDED FOR PLAY-BY-MAIL GAMING"
80 PRINT
90 PRINT "HIT 'RETURN' TO CONTINUE.'": INPUT XXXXX
100 CLS
110 PRINT "DO YOU WISH TO GENERATE A HARD-COPY PRINTOUT?": PRINT
120 PRINT " 1) YES 2) NO"
130 PRINT: INPUT HARD
140 IF HARD<1 OR HARD>2 THEN GOSUB 890
150 IF HARD<1 OR HARD>2 THEN GOTO 110
160 IF HARD=2 THEN GOTO 430
170 PRINT: PRINT "THE HARD-COPY RECORD OF YOUR 'DICE ROLLS' WILL BE MADE AS YOU USE THE": PRINT "PROGRAM. PLEASE MAKE SURE THAT YOUR PRINTER IS ON-LINE AND HAS PAPER.": PRINT
180 PRINT "HIT 'RETURN' TO CONTINUE.": INPUT XXXXX
190 PRINT
200 INPUT "WHAT IS YOUR NAME? ", N$
210 PRINT: INPUT "WHAT GAME ARE YOU PLAYING? ", GAME$
220 PRINT "THANK YOU."
230 LPRINT: LPRINT " PLAYER NAME: ";N$: LPRINT: LPRINT " GAME: ";GAME$: LPRINT: LPRINT " DATE: ";DATE$;" TIME START: ";TIME$
240 LPRINT: LPRINT: LPRINT: LPRINT
250 LPRINT SPACE$(5)"DIE ROLL NUMBER.....TYPE.....RESULT.....MODIFIERS?.....FINAL RESULT": LPRINT: LPRINT
260 LPRINT "..........................................................................."
270 GOTO 430
280 REM ****RANDOMIZER SUBROUTINE
290 R6=INT(RND*6)+1
300 R60=(INT(RND*6)+1)*10
310 R66=R60+R6
320 R12=R6+(INT(RND*6)+1)
330 R10A=INT(RND*10)+1
340 R10AA=INT(RND*10)+1
350 R10B=INT(RND*10)
360 R10BB=INT(RND*10)
370 R100=INT(RND*100)+1
380 R99=INT(RND*100)
390 R10P=R10A+(INT(RND*10)+1)
400 ROLL=ROLL+1
410 RETURN
420 REM ****MAIN MENU
430 CLS: PRINT: PRINT
440 PRINT "WHAT KIND OF DIE ROLL DO YOU WANT TO START WITH?": PRINT
450 PRINT " 1)SIX-SIDED DIE"
460 PRINT " 2)SUM OF TWO SIX-SIDED DICE"
470 PRINT " 3)TWO SIX-SIDED DICE IN SERIES (11 TO 66 RESULTS)"
480 PRINT " 4)TEN-SIDED DIE (0=10)"
490 PRINT " 5)TEN SIDED DIE (0=0)"
500 PRINT " 6)SUM OF TWO TEN-SIDED DICE (0=10)"
510 PRINT " 7)SUM OF TWO TEN-SIDED DICE (0=0)"
520 PRINT " 8)DECIMAL DICE (1-100)"
530 PRINT " 9)DECIMAL DICE (0-99)"
540 PRINT
550 PRINT " 10)END PROGRAM": PRINT
560 INPUT TYPE
570 IF TYPE<1 OR TYPE>10 THEN GOSUB 890
580 IF TYPE<1 OR TYPE>10 THEN PRINT: GOTO 450
590 GOSUB 280
600 IF TYPE=1 THEN RESULT=R6
610 IF TYPE=2 THEN RESULT=R12
620 IF TYPE=3 THEN RESULT=R66
630 IF TYPE=4 THEN RESULT=R10A
640 IF TYPE=5 THEN RESULT=R10B
650 IF TYPE=6 THEN RESULT=R10A+R10AA
660 IF TYPE=7 THEN RESULT=R10B+R10BB
670 IF TYPE=8 THEN RESULT=R100
680 IF TYPE=9 THEN RESULT=R99
690 IF TYPE=10 THEN GOTO 920
700 GOTO 770
710 PRINT: PRINT "DO YOU REALLY WISH TO QUIT?": PRINT: PRINT " 1)YES 2)NO": PRINT
720 INPUT QUIT
730 IF QUIT<1 OR QUIT>2 THEN GOSUB 890
740 IF QUIT<1 OR QUIT>2 THEN GOTO 710
750 IF QUIT=1 THEN GOTO 920
760 IF QUIT=2 THEN PRINT "THEN PLEASE PICK A DIE ROLL.": PRINT: GOTO 450
770 CLS
780 PRINT "ROLL: "; ROLL: PRINT
790 PRINT "TYPE: "; TYPE: PRINT
800 PRINT "RESULT: "; RESULT: PRINT
810 IF HARD=1 THEN GOSUB 840
820 PRINT "WHAT IS YOUR NEXT ROLL?": PRINT: GOTO 450
830 REM ****HARD-COPY PRINTOUT SUBROUTINE
840 LPRINT
850 LPRINT SPACE$(10); ROLL; SPACE$(12); TYPE; SPACE$(7); RESULT
860 LPRINT "..........................................................................."
870 RETURN
880 REM ****INVALID CHOICE SUBROUTINE
890 BEEP: PRINT "PLEASE MAKE A VALID CHOICE": PRINT
900 RETURN
910 REM ****QUITTING THE PROGRAM
920 PRINT: PRINT "DO YOU REALLY WANT TO QUIT?"
930 PRINT: PRINT " 1)YES 2)NO": PRINT
940 INPUT XX
950 IF XX<1 OR XX>2 THEN GOTO 890
960 IF XX<1 OR XX>2 THEN GOTO 920
970 PRINT
980 IF XX=2 THEN PRINT "THEN PLEASE PICK A DIE ROLL.": PRINT: GOTO 450
990 PRINT "VERY WELL. PROGRAM ENDING": PRINT
1000 IF HARD=1 THEN GOTO 1040
1010 PRINT: PRINT "PLEASE HIT 'RETURN.'": PRINT: INPUT XXXXX
1020 COLOR 7,0,0: CLS: KEY ON
1030 END
1040 LPRINT SPACE$(5); "KEY TO DIE ROLL TYPES:": LPRINT
1050 LPRINT SPACE$(10); "1----------SIX-SIDED DIE"
1060 LPRINT SPACE$(10); "2----------SUM OF TWO SIX-SIDED DICE"
1070 LPRINT SPACE$(10); "3----------TWO SIX-SIDED DICE IN SERIES (11-66 RESULTS)"
1080 LPRINT SPACE$(10); "4----------TEN-SIDED DIE (0=10)"
1090 LPRINT SPACE$(10); "5----------TEN-SIDED DIE (0=0)"
1100 LPRINT SPACE$(10); "6----------SUM OF TWO TEN-SIDED DIE (0=10)"
1110 LPRINT SPACE$(10); "7----------SUM OF TWO TEN-SIDED DIE (0=0)"
1120 LPRINT SPACE$(10); "8----------DECIMAL DICE (1-100)"
1130 LPRINT SPACE$(10); "9----------DECIMAL DICE (0-99)"
1140 LPRINT
1150 LPRINT SPACE$(5); "PROGRAM TERMINATED: ";TIME$
1160 PRINT: GOTO 1010


Back to Cry Havoc #4 Table of Contents
Back to Cry Havoc List of Issues
Back to MagWeb Master Magazine List
© Copyright 1993 by David W. Tschanz.
This article appears in MagWeb (Magazine Web) on the Internet World Wide Web. Other military history articles and gaming articles are available at http://www.magweb.com