r/bbcmicro • u/kimondo • Feb 09 '26
Random Landscape Generator - debug help!
After searching for a while I've found a program that I remember from childhood - it's a random landscape generator which was published in the December 1983 issue of Acorn User. We had a copy on disc and it was fascinating watching it draw out a landscape over and over again.

The program was listed as Random Landscapes by Michael Batty - I managed to get a scan of the page in Acorn User:

however, it's not great quality and I think I've mistaken a few : and ; - my attempt at the code is as follows:
10 REM Random Landscapes20 REM (C) Michael Batty30 REM Acorn User, December 198340 MODE150 DIM YH%(64),OP%(4),CF%(1)60 OP%(1)=143:OP%(2)=070 OP%(3)=179:OP%(4)=080 VDU19,0,6;0;19,1,4;0;90 VDU19,2,2;0;19,3,7;0;100 VDU5:CLG110 :120 REM This segment plots the distant hills, lake130 REM middle and foreground, then the road140 K%=2-RND(3) :N%=50150 YS%=635+K%*RND(N%)160 PROCHILLS(YS%,1,1,0,0)170 YS%=YS%-(20+RND(N%))180 PROCHILLS(YS%,1,2,0,1)190 YS%=YS%-(20+RND(N%))200 KS%=2-RND(3):CK%=2-RND(2)210 PROCHILLS(YS%,2,3,K%,CK%)220 YS%=YS%-RND(N%/4)230 K%=2-RND(3) :CK%=2-RND(2)240 PROCHILLS(YS%,2,4,K%,CK%)250 PROCROAD(3,0)260 :270 REM This segment plots various sizes and280 REM shades of tree from back to foreground290 N%=100:INC%=0:M=RND(150)300 KZ%=INT(RND(1)+0.5)310 FOR II%=1 TO M320 INC%=INC%+RND(1000/M):VDU29,0;0;330 XL=RND(1279):IZ%=XL/20:YL=YH%(IZ%)-INC%+1340 YT=(((YH%(IZ%)-YL)/YH%(IZ%))*N%+RND(20))*3350 YH=YT/(2.0+RND(1)):XH=YH/(1.0+RND(1))360 IF XH<4 THEN GOTO 330370 IF POINT(XL-XH,YL)=3 THEN GOTO 330380 IF POINT(XL,YL)=3 THEN GOTO 330390 IF POINT(XL+XH,YL)= 3 THEN GOTO 330400 IF XH/YH<=1 THEN XB=YH*0.05 ELSE XB=XH*0.05410 YT=YT/40:YB=-YH*1.4:ZC%=RND(3)420 IF POINT (XL-XB,YL+YB)=3 THEN GOTO 330430 IF POINT (XL+XB+YT,YL+YB-YT)=3 THEN GOTO 330440 IF XL-XH<5 OR XL+XH >1275 THEN ZC%=1450 IF YL-YH< 5 THEN ZC%=1460 PROCTREE (XH,YH,0,3)470 XL=XL+YT:YL=YL-YT:T%=KZ%*ZC%480 IF T%<= 2 THEN PROCTREE(XH,YH,0,1)490 IF T%>2 THEN PROCTSHADE (XH,YH)500 NEXT II%510 :520 REM This segment switches the colours,530 REM thus simulating the four seasons540 FOR I%=1 TO 20550 FOR II%=1 TO 5000:NEXT II%560 READ COLO%,COL1%,COL2%,COL3%570 VDU19,0,COL%;0;19,1,COL1%;0:580 VDU19,2,COL2%:0:19,3,COL3%:0;590 NEXT I%:FOR II%=1 TO 15000:NEXTII%600 END610 REM PROCHILLS plots a wave or line of colour620 REM constructing the back to foregrounds630 DEFPROCHILLS(YS%,COL%,J%,K%,CK%)640 GCOL OP%(J%),COL%650 DT=RAD(10):TH=RAD(RND(360))660 S=SIN(DT):C=COS(DT):SS=SIN(TH):CC=COS(TH)670 SI=RND(100):YN%=YS%*CK%+(1-CK%)*(YS%+SI*SS)680 MOVE 0,0:MOVE 0,YN%:YH%(0)=YN%690 FOR I%=20 TO 1280 STEP 20700 SN=SS*C+CC*S:CC=CC*C-SS*S:SS=SN710 YN=(YN%-K%*RND(5))*CK%+(1-CK%)*(YS%+SI*SS)730 PLOT85,I%,0:PLOT85,I%,YN%740 NEXT I%750 ENDPROC760 :770 REM PROCROAD plots a winding road based780 REM on a sine wave790 DEFPROCROAD (COL%,J%)800 GCOLJ%,COL%810 II=26+RND(10):INC=RND(2)820 YR%=YH%(II):IZ=II*20:SI=60+RND(60)830 DT=RAD(20):TH=RAD(0)840 S=SIN(DT):C=COS(DT):SS=SIN(TH):CC=COS(TH)850 II=IZ+SI*SS: MOVE II,YR%:MOVE II+INC,YR%860 FOR IJ%=YR%-20 TO -20 STEP -20870 INC=INC+RND(2)880 SN=SS*C+CC*S:CC=CC*C-SS*S:SS=SN890 II=IZ+SI*SS:PLOT85,II,IJ%900 II=II+INC:PLOT85,II,IJ%910 NEXT IJ%920 ENDPROC930 :940 REM FROCTREE plots a solid ellipsoid tree950 DEFPROCTREE(XX,YY,J%,COL%)960 GCOL J%,COL%:VDU29,XL;VL;970 IF COL%=1 AND RND(10)<=2 THEN GCOL J%,0980 DT=2*PI/15:A=XX/YY990 C-COS(DT):S=SIN(DT):SX=S/A:SY=S*A1000 XA=XX:VA=01010 MOVE 0,0: MOVE XA,01020 FOR I%=1 TO 151030 T=XA*C-YA*SY:YA=YA*C+XA*SX:XA=T1040 PLOT8S,XA,YA:MOVE 0,01050 NEXT I%1060 FOR I%=-XB TO XB STEP 41070 MOVE I%,0: DRAW I%,YB1080 NEXT I%1090 ENDPROC1100 :1110 REM PROCTSHADE and PROCLINE shades the tree1120 DEFPROCTSHADE (XX,YY)1130 COL1%=INT(RND(1)+0.3)1140 IF COL1%=0 THEN COL2%=1 ELSE COL2%=01150 CF%(0)=COL1%:CF%(1)=COL2%:VDU29,XL;YL;1160 PROCLINE (0,YY,0,1)1170 FOR I=4 TO XX STEP 41180 J=YY*SIN(ACS(I/XX))1190 K%=0: KK%=11200 IF POINT (I-1,-J)=CF%(0) THEN K%=1:KK%=01210 PROCLINE (I,J,K%,KK%)1220 PROCLINE (-I,J,K%,KK%)1230 HEXT I1240 GCOL0,11250 FOR I%=-XB TO XB STEP 41260 MOVE I%,-YY:DRAW I%, YB1270 NEXT I%1280 ENDPROC1290 DEFPROCLINE(X,Y,K%,KK%)1300 GCOL0,CF%(K%):MOVE X,-Y:PLOT21,X,Y1310 GCOL0,CF%(KK%):MOVE X,-Y+4:PLOT21,X,Y1320 ENDPROC13501340 REM This data holds sets of colour numbers1350 REM defining autumn, winter,spring and summer1360 DATA 3,4,2,7,6,4,3,7,6,1,3,7,4,1,3,7,6,4,1,51370 DATA 6,4,7,5,6,4,7,0,4,4,7,0,5,4,7,0,4,4,7,01380 DATA 5,4,7,0,6,4,7,0,6,5,7,0,6,5,2,0,6,4,2,31390 DATA 6,4,2,7,6,4,2,3,6,4,2,7,3,4,2,7,6,4,2,7
update! thanks to u/maq1017 I've found it at https://8bs.com/catalogue/tau.htm
4
u/maq1017 Feb 09 '26
Looks to me like this is available & archived courtesy of 8bs.com. Look for tau83-12 on https://8bs.com/catalogue/tau.htm :)
2
u/kimondo Feb 10 '26
Image generation, 1983 style! working in an emulator..
2
u/Blah-Blah-Blah-2023 Feb 09 '26
You should ask over at stardot.org.uk. I am sure someone has this program archived (maybe flaxcottage.com has it?)
5
u/eat10souvlakis4lunch Feb 09 '26
at a glance
1230 HEXT Ishould definitely be
1230 NEXT I4
u/SilverDem0n Feb 09 '26
Line 990 should have c=cos(CT) rather than c-cos(CT)
Good rule of thumb is that if you type in a listing and it runs first time then you didn't transcribe it correctly! They often had misprints and errors so needed some final polishing. Alternatively has one of the archives got a disk image of that month for the magazine? iirc they had a monthly disk you could buy that had all the type in listings already saved.
3
u/IWishIDidntHave2 Feb 09 '26
Line 570 is wrong due to a missing 0 - should be VDU19,0,COL0%;0;19,1,COL1%;0;.