"3D" triangles/patterns (BBC BASIC)

discussion of beeb/electron applications, languages, utils and educational s/w
Post Reply
User avatar
lurkio
Posts: 2147
Joined: Tue Apr 09, 2013 11:30 pm
Location: Doomawangara
Contact:

"3D" triangles/patterns (BBC BASIC)

Post by lurkio » Mon Apr 08, 2019 9:29 pm

From the August 1982 issue of Your Computer magazine:
3D triangle / D Konig, Hexham, Northumbria / This program will run on the BBC model A microcomputer and posssibly on the model B. It simulates the random movement through three dimensions of a triangle. It can also be made to leave a trace of itself on the screen. The background and foreground colours are user-definable in accordance with the tables on page 55 of the Provisional User Guide. The user also has the choice of just bouncing triangles or a trace leaving a bouncing triangle ... When the program is running pressing the space bar will stop the action; ... pressing C will clear the screen but continue as before; pressing E will escape from the program.
The (hacked) listing:

Code: Select all

100REM***3-D TRIANGLES AND PATTERNS***
110REM****BY D.KONIG AND P.MCCOWIE****
115REM*********(C) 14/5/1982**********
117REM input and ruined by lurkio @ Stardot, 2019
120MODE7:FORI=1TO2:PRINTTAB(5,10+I)CHR$141"PATTERNS AND TRIANGLES":NEXT
130B%=INKEY(500):MODE4:VDU19,1,3,0,0,0,19,2,1,0,0,0:PRINTTAB(1,3)"WHEN ROUTINE BEGINS PRESS:":PRINTTAB(1,5)"<SPACE> TO PAUSE.":PRINTTAB(1,7)"<C> TO CLEAR SCREEN.":PRINTTAB(1,9)"<E> TO END"
160PRINTTAB(1,11)"WHICH BACKGROUND COLOUR ?":INPUTTAB(1,13)"(0-15) ",G%:IFG%<0ORG%>15THEN160
180PRINTTAB(1,13);SPC(10):IFRND(-TIME)
190PRINTTAB(1,11)"WHICH FOREGROUND COLOUR ?":INPUTTAB(1,13)"(0-15) ",H%:IFH%<0ORH%>15THEN190
210PRINTTAB(1,11)"DO YOU WANT A PATTERN OR TRIANGLE ?":PRINTTAB(1,13);SPC(10):INPUTTAB(1,13)"(P-T) ",F$:IFF$="P"THENZ%=0ELSEZ%=1
230MODE4:VDU23,1,0;0;0;0;19,1,H%,0;0;19,2,G%,0;0;:A%=RND(30):B%=RND(30):C%=RND(30):D%=RND(30):E%=RND(30):F%=RND(30):X%=400:Y%=400:I%=700:K%=500:J%=500:L%=700:GCOL0,1
250MOVEX%,Y%:DRAWI%,K%:DRAWJ%,L%:DRAWX%,Y%:A$=INKEY$(0):IFA$=" "THENPROCP
270IFA$="C"THENCLS
280IFA$="E"THENEND
290IFX%>1280ORX%<0THENA%=-A%
300IFI%>1280ORI%<0THENC%=-C%
310IFJ%>1280ORJ%<0THENE%=-E%
320IFY%>1024ORY%<0THENB%=-B%
330IFK%>1024ORK%<0THEND%=-D%
340IFL%>1024ORL%<0THENF%=-F%
345SOUND1,-15,X%/5,1:SOUND2,-15,I%/5,1:SOUND3,-15,J%/5,1
350IFZ%GCOL0,2:DRAWI%,K%:DRAWJ%,L%:DRAWX%,Y%:GCOL0,1
360X%=X%+A%:Y%=Y%+B%:I%=I%+C%:K%=K%+D%:J%=J%+E%:L%=L%+F%:GOTO250
380DEFPROCP
390IFGET$<>" "THEN390:*FX15,0
400ENDPROC
Run the (compressed) program in JSBeeb:
:idea:
Last edited by lurkio on Mon Apr 08, 2019 10:02 pm, edited 1 time in total.

User avatar
AndyF
Posts: 1270
Joined: Sat Feb 23, 2008 10:16 pm
Location: Derby
Contact:

Re: "3D" triangles/patterns (BBC BASIC)

Post by AndyF » Tue Apr 09, 2019 7:04 am

I like that. :)

Suggestions:

1. Offer an option to disable sound maybe ? I simply REM'ed out line 345 to silence it!
2. Perhaps a random choice of colours could be picked and cycled after x minutes ? Or maybe during 'draw' itself perhaps.

Its very good though all in all.
Andy

* NEW * The Jetset Willy and Manic Miner community :)

Adventure games ported across to the BBC (in progress) as soon as I can find some time!

User avatar
Elk2019
Posts: 45
Joined: Wed Apr 03, 2019 5:25 pm
Contact:

Re: "3D" triangles/patterns (BBC BASIC)

Post by Elk2019 » Tue Apr 09, 2019 12:32 pm

This is a good graphics demonstration that also works on the Electron. I am searching for a Spirograph program which I had on the Beeb. It was similar to the popular kids toy and would create wonderful geometrical patterns. Does anyone have it?

User avatar
lurkio
Posts: 2147
Joined: Tue Apr 09, 2013 11:30 pm
Location: Doomawangara
Contact:

Re: "3D" triangles/patterns (BBC BASIC)

Post by lurkio » Tue Apr 09, 2019 3:30 pm

Elk2019 wrote:
Tue Apr 09, 2019 12:32 pm
This is a good graphics demonstration that also works on the Electron. I am searching for a Spirograph program which I had on the Beeb. It was similar to the popular kids toy and would create wonderful geometrical patterns. Does anyone have it?
Is it this one?:
The video description says it’s from the book “Advanced Graphics with the BBC Model B Microcomputer”.

:?:

User avatar
Elk2019
Posts: 45
Joined: Wed Apr 03, 2019 5:25 pm
Contact:

Re: "3D" triangles/patterns (BBC BASIC)

Post by Elk2019 » Thu Apr 11, 2019 8:45 am

After doing further research, I think the program I used was The Designers Pencil :wink:

Post Reply