31 Day Character Creation Challenge (Day 31), or, Rolling 3d6 in order in two types of BASIC

Scott's picture
Screen Shot of a Commodore 64 screen
Casio PB-80 pocket computer

Today is the last day of the 31-day Character Creation challenge. This time, instead of rolling up a character, I thought I'd report on something I've been working on and off for the past year or so.

Sometime during the last few months of 2019, I became interested in rolling up characters using only 3d6 in order per the original D&D method, just to see what outcomes were to be had. But because I was lazy, or didn't have a whole lot of time on my hands, I decided to conduct the experiment using BASIC running on an emulated Commodore machine.

Arguably, I could get better results using a more modern programming language/computer, but I was also feeling strongly nostalgic for my old Commodore 128 days.

 

10 rem d&d/ad&d character attributes
20 rem randomizer/generator
30 rem
40 rem s = str, i = int, d = dex, w = wis, c = con, ch= chas, c = con, ch= cha
50 r3=0:r4=0:r5=0:r6=0:r7=0:r8=0:r9=0:ra=0
60 rb=0:rc=0:rd=0:re=0:rf=0:rg=0:rh=0:ri=0
70 print chr$(147)
80 x=rnd(-ti) : rem seed generation for rnd calls
90 input "how many characters do you wish to roll up";h
100 for hr = 1 to h
110 d1=0:d2=0:d3=0
120 print"rolling character ";hr; ": " "
130 for dx=1 to 6 :read ca$
140 let x=1
150 d1=int(rnd(x)*6+1)
160 d2=int(rnd(x)*6+1)
170 d3=int(rnd(x)*6+1)
180 print "3d6: "; d1; d2; d3;
190 let dt=d1+d2+d3
200 if dt=3 then r3=r3+1 : rem incrementers for determining distribution
210 if dt=4 then r4=r4+1 : rem (should be a symmetrical bell curve!)
220 if dt=5 then r5=r5+1
230 if dt=6 then r6=r6+1
240 if dt=7 then r7=r7+1
250 if dt=8 then r8=r8+1
260 if dt=9 then r9=r9+1
270 if dt=10 then ra=ra+1
280 if dt=11 then rb=rb+1
290 if dt=12 then rc=rc+1
300 if dt=13 then rd=rd+1
310 if dt=14 then re=re+1
320 if dt=15 then rf=rf+1
330 if dt=16 then rg=rg+1
340 if dt=17 then rh=rh+1
350 if dt=18 then ri=ri+1
360 if dx=1 then let s=dt
370 if dx=1 then print "--- ";ca$;": ";dt
380 if dx=2 then let i=dt
390 if dx=2 then print "--- ";ca$;": ";dt
400 if dx=3 then let d=dt
410 if dx=3 then print "--- ";ca$;": ";dt
420 if dx=4 then let w=dt
430 if dx=4 then print "--- ";ca$;": ";dt
440 if dx=5 then let c=dt
450 if dx=5 then print "--- ";ca$;": ";dt
460 if dx=6 then let ch=dt
470 if dx=6 then print "--- ";ca$;": ";dt
480 next dx
490 if h=hr then end
500 s=0:i=0:d=0:w=0:c=0:ch=0:dx=0:restore:rem reset vars/pointer
510 print "3:";r3;"4:";r4;"5:";r5;"6:";r6
520 print "7:";r7;"8:";r8;"9:";r9;"10:";ra
530 print "11:";rb;"12:";rc;"13:";rd
540 print "14:";re;"15:";rf;"16:";rg
550 print "17:";rh;"18:";ri:print
560 next hr
570 data "str","int","dex","wis","con","cha"

But I didn't start there. Before I even got to programming the Commodore stuff, I actually started working on my old 80s-vintage Casio PB-80 portable databank/calculator/personal computer to see if I could get it to do something similar. I am by no means a competent programmer, but because the Casio PB-80 has a databank (which shares memory with the entire system), I made a modified version which will roll up to 6 characters and write the results to the databank. Six is the maximum for a stock PB-80—544 bytes isn't a lot of memory, unless I disposed with the nicety of having labels inserted before each stat.

Here's what I came up with, a bit of time invested in an obscure purpose in one of the most obscure platforms, ever:

10 RESTORE#:CLEAR
20 INPUT P
30 FOR G = 1 TO P
40 FOR D=1 TO 6
50 T=0
60 FOR X=1 to 3
70 Y=INT (RAN#*6)+1
80 T=T+Y
90 NEXT X
100 IF D=1 THEN S=T
110 IF D=2 THEN I=T
120 IF D=3 THEN W=T
130 IF D=4 THEN E=T
140 IF D=5 THEN C=T
150 IF D=6 THEN A=T
160 NEXT D
170 N$="·"+ STR$(G)
180 S$="St→"+ STR$(S)
190 I$="In→"+ STR$(I)
200 W$="Ws→"+ STR$(W)
210 D$="Dx→"+ STR$(E)
220 C$="Cn→"+ STR$(C)
230 H$="Ch→"+ STR$(A)
240 WRITE# N$,S$,I$,W$,D$,C$,H$
250 BEEP
260 NEXT G

The whole thing fits within 278 bytes! And comes with a small dose of seratonin with the accomplishment.

And though its only useful to someone like myself, I used the program to fill a page of nothing but character stats as generated by the Casio PB-80 in BASIC. It was like I was back in high school doing things of no use to anyone else, wasting time between classes, though I never produced anything anywhere near as sophisticated as this little program back then.

None of this really replaces dice, nor any of the alterative methods for rolling up characters as described for any particular game—my project is pretty specifically focused on D&D character creation.

And because I found it fun to return to using what I used to use these old computers for — rolling up a bunch of characters so I could fill out a character sheet.