Any short type-ins for unattended Beebs?

discussion of beeb/electron applications, languages, utils and educational s/w
User avatar
BigEd
Posts: 2058
Joined: Sun Jan 24, 2010 10:24 am
Location: West
Contact:

Any short type-ins for unattended Beebs?

Post by BigEd » Sun Apr 08, 2018 6:48 pm

Now and again I find myself at a computer museum with a Basic prompt - it would be good to have a program or two to type in, to entertain or bemuse anyone wandering by afterwards.

Usually I just do
> PRINT PI
or similar, but that really isn't impressive.

If I have it to hand, I can fairly quickly type in the Sphere benchmark:

Code: Select all

   10 TIME=0
   20 CLS
   30 S%=400
   40 VDU29,640;512;
   50 MOVE 0,0
   60 FOR A=0 TO 126 STEP .25: DRAW S%*SINA,S%*COSA*SIN(A*.95):NEXT
   70 PRINT TIME/100
which comes to us via ​Michael Firth, from an unknown source.

Any other ideas for type-ins? Plotting random coloured triangles perhaps? Anything else with colours? Or maybe printing out Fibonacci numbers or primes?

Maybe even a game that's short enough to type in?

(Unattended Elks, Masters or Archies: same question applies!)

User avatar
SimonSideburns
Posts: 282
Joined: Mon Aug 26, 2013 8:09 pm
Location: Purbrook, Hampshire
Contact:

Re: Any short type-ins for unattended Beebs?

Post by SimonSideburns » Sun Apr 08, 2018 10:48 pm

Attempt to write a program that draws non-overlapping filled circles onto the screen.

That takes some doing, and gets you thinking too, or try to write a mandelbrot drawing program (slow in BASIC but entertaining nonetheless).
I'm writing a game where you can change your character from a Wizard to a monkey to a cat.

Well, Imogen that!

User avatar
pau1ie
Posts: 541
Joined: Thu May 10, 2012 9:48 pm
Location: Bedford
Contact:

Re: Any short type-ins for unattended Beebs?

Post by pau1ie » Sun Apr 08, 2018 10:48 pm

I do something like this:

Code: Select all

10 MODE 2
20 X=640:Y=512
30 MOVE X,Y
40 GCOL0,RND(7)
50 X=X+RND(17)-9: IF X < 0 OR X > 1280 THEN X=640
60 Y=Y+RND(17)-9: IF Y < 0 OR Y > 1024 THEN Y=512
70 DRAW X,Y
80 GOTO 40
I did this at The National Museum for computing and the guys were blown away (They were young) It would benefit from switching off the cursor but I can never remember how to do that.
I'm working on http://bbcmicro.co.uk

User avatar
Lion
Posts: 412
Joined: Sat Mar 14, 2009 6:56 pm
Location: Woodside, California
Contact:

Re: Any short type-ins for unattended Beebs?

Post by Lion » Sun Apr 08, 2018 10:52 pm

Cheap and nasty starfield:

Code: Select all

10 MODE 2
20 REPEAT
30 GCOL 0,RND(7)
40 PLOT 69,RND(1280),0
50 PRINT
60 UNTIL FALSE

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

Re: Any short type-ins for unattended Beebs?

Post by lurkio » Sun Apr 08, 2018 10:56 pm

Code: Select all

MODE7:VDU23,1,0;0;0;0;:REPEATM%=&7C00:FORJ%=1TO25:?M%=144+RND(7):M%?1=152+RND(2):M%=M%+2:FORI%=1TO38:REPEATR%=RND(64):UNTILR%<32ORR%>33:?M%=R%-30*(R%>32)+32:M%=M%+1:NEXT:NEXT:TIME=0:REPEATUNTILTIME>100:CLS:UNTIL0



User avatar
pau1ie
Posts: 541
Joined: Thu May 10, 2012 9:48 pm
Location: Bedford
Contact:

Re: Any short type-ins for unattended Beebs?

Post by pau1ie » Sun Apr 08, 2018 11:08 pm

The other one I do is the simple number guessing game. Again the guys at TNMOC were impressed, but not as much as with the graphical one!

Code: Select all

 10 MODE7
 20 P."Can you guess my number?
 30 P."It is between 1 and 100."
 40 N=RND(100):G=0
 50 G=G+1
 60 P."Guess ";G
 70 I.T
 80 IF T=N THEN GOTO 120
 90 IF T > N THEN P."Too big."
100 IF T < N THEN P."Too small."
110 GOTO 50
120 P."You got it in ";G;" goes"
130 P."Well Done!"
140 P."Let's try again!"
150 P.
160 GOTO 20
I'm working on http://bbcmicro.co.uk

User avatar
pau1ie
Posts: 541
Joined: Thu May 10, 2012 9:48 pm
Location: Bedford
Contact:

Re: Any short type-ins for unattended Beebs?

Post by pau1ie » Sun Apr 08, 2018 11:17 pm

Lion wrote:Cheap and nasty starfield:
I'm going to use this one - Nice!
I'm working on http://bbcmicro.co.uk

crj
Posts: 834
Joined: Thu May 02, 2013 4:58 pm
Contact:

Re: Any short type-ins for unattended Beebs?

Post by crj » Mon Apr 09, 2018 2:33 am

Code: Select all

10 MODE 4
20 DIM X%(3),Y%(3)
30 X%(1)=32:Y%(1)=32
40 X%(2)=1248:Y%(2)=32
50 X%(3)=640:Y%(3)=992
60 X%=RND(1280):Y%=RND(1024)
70 REPEAT
80 N%=RND(3)
90 X% = (X%+X%(N%))/2 : Y% = (Y%+Y%(N%))/2
100 PLOT 69,X%,Y%
110 UNTIL FALSE
Spoiler: it produces this, which often surprises people. (-8
Disclaimer: I just typed it from memory, so I hope it works!

User avatar
Lion
Posts: 412
Joined: Sat Mar 14, 2009 6:56 pm
Location: Woodside, California
Contact:

Re: Any short type-ins for unattended Beebs?

Post by Lion » Mon Apr 09, 2018 2:37 am

crj wrote:Disclaimer: I just typed it from memory, so I hope it works!
It does work, but it looks even better in mode 0.

crj
Posts: 834
Joined: Thu May 02, 2013 4:58 pm
Contact:

Re: Any short type-ins for unattended Beebs?

Post by crj » Mon Apr 09, 2018 2:42 am

Oh, there's also Rheolism for the Archimedes, of course.
Last edited by crj on Mon Apr 09, 2018 11:57 am, edited 1 time in total.

User avatar
BigEd
Posts: 2058
Joined: Sun Jan 24, 2010 10:24 am
Location: West
Contact:

Re: Any short type-ins for unattended Beebs?

Post by BigEd » Mon Apr 09, 2018 6:12 am

Thanks for all the contribs! (There's also a Rheolism (T*tris) for the Beeb: the section before this one.)

There are three modest-sized Lunar Landers, and much else besides, in this 1975 compendium:
dec :: Books :: 101 BASIC Computer Games Mar75
(Might need a little tweaking for BBC Basic)

recycled
Posts: 9
Joined: Sun Oct 25, 2009 8:38 pm
Location: New Zealand
Contact:

Re: Any short type-ins for unattended Beebs?

Post by recycled » Mon Apr 09, 2018 6:43 am

You can't go wrong with a one liner, green bottles, and recursion. But two out of three can still leave people smiling.

Code: Select all

10gb$=" green bottles":sw$=" sitting on a wall.":FORi%=100TO1STEP-1:FORJ%=1TO2:PRINT;i%;LEFT$(gb$,LEN(gb$)+(i%=1));sw$:NEXT:PRINT"Take one down and pass it around and now there's":NEXT:PRINT"No more";gb$;sw$
(edited bad formatting from Beebem screen reader view)

User avatar
FourthStone
Posts: 556
Joined: Thu Nov 17, 2016 2:29 am
Location: Melbourne, Australia
Contact:

Re: Any short type-ins for unattended Beebs?

Post by FourthStone » Mon Apr 09, 2018 9:06 am

I used to like typing in this at stores displaying various 8 bit computers, a little scroller proggie.

Code: Select all

   10 MODE 7:VDU 23,1,0;0;0;0;
   20 PRINT "Type a message to scroll:"
   30 INPUT A$
   40 IF LEN(A$)<40 A$=A$+STRING$(40-LEN(A$)," ")
   50 IF LEN(A$)>40 THEN A$=LEFT$(A$,40)
   60 X=0
   70 PRINTTAB(0,10)RIGHT$(A$,40-X);LEFT$(A$,X)
   80 X=X+1:IF X>39 X=0
   90 IF INKEY(10)>-1 GOTO 10
  100 GOTO 70

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

Re: Any short type-ins for unattended Beebs?

Post by AndyF » Mon Apr 09, 2018 10:02 am

I tend to do something a bit like this:

Code: Select all

10MODE2:VDU 23;11,0;0;0;0
20X=INTRND(1280):Y=INTRND(1024)
30GCOL0,INTRND(7):IFP%MOVEX,Y
40DRAWX,Y
50A$=INKEY$(0)
60IFA$="L"P%=FALSE:VDU7:GOTO10
70IFA$="P"P%=TRUE:VDU7:GOTO10
80GOTO20
Press 'L' to switch to Line mode
Press 'P' to switch to Pixel mode

Could be written a lot better and more efficiently! (even I can see that but its a quick thing without too much thought, quick being the primary word here I suppose, with a view to efficiency once "it works") , perhaps also resetting the screen and / or choice after a certain time too would be a neat thought. =D> , certainly a bit of scope here.

Combi preview pic: Listing / Lines / Pixels:
random_lines.png
Erm , enjoy ? :D
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
BigEd
Posts: 2058
Joined: Sun Jan 24, 2010 10:24 am
Location: West
Contact:

Re: Any short type-ins for unattended Beebs?

Post by BigEd » Mon Apr 09, 2018 10:18 am

Thanks for the screenshots! I feel a compendium SSD image might be needed, but there might be more ideas coming yet...

User avatar
dv8
Posts: 140
Joined: Mon Jun 22, 2009 9:07 pm
Contact:

Re: Any short type-ins for unattended Beebs?

Post by dv8 » Mon Apr 09, 2018 11:53 am

Code: Select all

   10 MODE 4:VDU 23,1,0;0;0;0;31,0,31
   20 W%=200:H%=W%/2:S%=5:X%=0:D%=1
   30 FOR I%=-W% TO W% STEP S%
   40 VDU 29,640+X%;300;:X%=X%+D%:IF X%>W% OR X%<-W% THEN D%=-D%
   50 MOVE 0,H%:DRAW I%,0:DRAW 0,-W%:DRAW -I%,0:DRAW 0,H%
   60 IF RND(1)>0.9 PRINT TAB(RND(38))"*" ELSE PRINT TAB(RND(38))"."
   70 NEXT:GOTO30

JoolsH
Posts: 517
Joined: Mon May 21, 2012 11:46 am
Contact:

Re: Any short type-ins for unattended Beebs?

Post by JoolsH » Mon Apr 09, 2018 12:03 pm

Always a fun one on the school beebs:

Code: Select all

10 ?RND=RND:RUN

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

Re: Any short type-ins for unattended Beebs?

Post by AndyF » Mon Apr 09, 2018 12:21 pm

BigEd wrote:Thanks for the screenshots! I feel a compendium SSD image might be needed, but there might be more ideas coming yet...
Here is a variation on the previous one of mine, it undraws (read that as drawing in blank ink) , same thing. I call it "fading lines and pixels" it works best with various values in line 30 however, typically a higher value (default 5) for lines and possibly a tweak for pixels. Too high a value for pixels will make it "appear" slow though.

Code: Select all

10ONERRORMODE7:REPORT:END
20MODE2:VDU 23;11,0;0;0;0
30FORT=0TO5
40GCOL0,0:PROCP:NEXTT
50GCOL0,INTRND(7):PROCP
60GOTO30
70
80DEFPROCP
90X=INTRND(1280):Y=INTRND(1024)
100A$=INKEY$(0)
110IFA$="L"P%=FALSE:CLG
120IFA$="P"P%=TRUE:CLG
130IFP%MOVEX,Y
140DRAWX,Y:ENDPROC
Preview pic again, it looks better in reality (lines especially, please try adjusting the TO value in LINE 30) though...
fading_lines_pixels.png
As an aside I did try ages ago something like this combining both lines and pixels but it looked messy. The solution (I was too lazy to do at that time) would of been to store the co-ords of the line so when the pixel was plotted (as in draw 1x line , draw 5x pixels) it would then 'carry on' from the last line draw position instead of random.

EDIT... 70 is meant to be blank, well kind of. Just my way of working prefer a 'space' as such between program and proc's
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
BigEd
Posts: 2058
Joined: Sun Jan 24, 2010 10:24 am
Location: West
Contact:

Re: Any short type-ins for unattended Beebs?

Post by BigEd » Mon Apr 09, 2018 6:52 pm

I've never tried to do it, but a walking line with bouncing ends, Qix-style, should presumably not be _too_ difficult? I saw an Apple II doing that, once, so far back in the day that it might have been my first glimpse of a colour monitor. I was amazed!

User avatar
ctr
Posts: 163
Joined: Wed Jul 16, 2014 2:53 pm
Contact:

Re: Any short type-ins for unattended Beebs?

Post by ctr » Mon Apr 09, 2018 8:19 pm

You could possibly shorten this by using a four-element array for the positions and a similar array for the velocities.

Code: Select all

    0REM Walking Lines
   10MODE2
   20VDU23,1,0;0;0;0;
   30X%=640:Y%=512:A%=768:B%=768
   40V%=32:W%=24:C%=16:D%=-28
   50DIME%(7),F%(7),G%(7),H%(7)
   60FORI%=1TO7
   70GCOL3,I%
   80MOVEE%(I%),F%(I%):DRAWG%(I%),H%(I%) 
   90E%(I%)=X%:F%(I%)=Y%:G%(I%)=A%:H%(I%)=B%
  100MOVEX%,Y%:DRAWA%,B%
  110X%=X%+V%:Y%=Y%+W%
  120IFX%>1280ORX%<0THENV%=-V%
  130IFY%>1024ORY%<0THENW%=-W%
  140A%=A%+C%:B%=B%+D%
  150IFA%>1280ORA%<0THENC%=-C%
  160IFB%>1024ORB%<0THEND%=-D%
  170NEXT
  180GOTO60

User avatar
BigEd
Posts: 2058
Joined: Sun Jan 24, 2010 10:24 am
Location: West
Contact:

Re: Any short type-ins for unattended Beebs?

Post by BigEd » Mon Apr 09, 2018 8:28 pm

Most excellent!

I've made up an ssd (and updated it) - I think I have everyone's contributions, and a couple more. Every file is a *EXEC type of thing, may need NEW and may need an appropriate MODE.

(The Dragon fractal program is crudely adapted from a Rosetta code version in BBC Basic For Windows, and it really needs a Beeb rewrite.

Code: Select all

AUTO

MODE 0
MOVE 800,400
REM GCOL 11
PROCdragon(512, 12, 1)
END

DEF PROCdragon(size, split%, d)
IF split% = 0 THEN PLOT 1, -COS(angle)*size, SIN(angle)*size
IF split% <> 0 THEN angle = angle + d*PI/4
IF split% <> 0 THEN PROCdragon(size/SQR(2), split%-1, 1)
IF split% <> 0 THEN angle = angle - d*PI/2
IF split% <> 0 THEN PROCdragon(size/SQR(2), split%-1, -1)
IF split% <> 0 THEN angle = angle + d*PI/4
ENDPROC
)
Attachments
play.ssd
(200 KiB) Downloaded 32 times
Last edited by BigEd on Mon Apr 09, 2018 8:56 pm, edited 1 time in total.

User avatar
lcww1
Posts: 274
Joined: Wed Mar 15, 2017 11:16 pm
Location: Moon Base Alpha
Contact:

Re: Any short type-ins for unattended Beebs?

Post by lcww1 » Mon Apr 09, 2018 8:49 pm

What an utterly glorious thread! A really inspired idea BigEd!

Here's my contribution - based on listing 2-3 from the rather splendid Chaos Cookbook: A Practical Programming Guide by Joe Pritchard, which contains many interesting programs in BBC Basic. This one does need a little patience, however (hence the beep at the end, to wake you up when it's done :) ).

Code: Select all

   10 CLS
   20 YS=500:YO=100
   30 MODE 4
   40 I=1
   50 K=3
   60 REPEAT
   70 X=0.5
   80 FOR J=1 TO 50
   90 X=X*K*(1-SIN(X))
  100 IFABS(X)>2E6 THEN X=2E6
  110 NEXT
  120 FOR J=1 TO 200
  130 X=X*K*(1-SIN(X))
  140 IF ABS(X)>2E6 THEN X=2E6
  150 GCOL0,1
  160 PLOT69,I*2,INT(X*YS)+YO
  170 NEXT
  180 K=K+0.01
  190 I=I+1
  200 UNTIL (K>=12) OR (I*2>=1000)
  210 VDU7
  220 G=GET
  230 END
The result is an image of the bifurcation diagram for xn=kxn-1(1-sin(xn-1), which I've always found rather fascinating:
Bifurcation.png
Bifurcation diagram

User avatar
BigEd
Posts: 2058
Joined: Sun Jan 24, 2010 10:24 am
Location: West
Contact:

Re: Any short type-ins for unattended Beebs?

Post by BigEd » Mon Apr 09, 2018 9:02 pm

Ambitious! I've a feeling it overplots: I*2 should perhaps be I*4? In which case other things might perhaps be usefully rescaled? I reduced the iteration count too, to see more progress. But your version as presented is on the new updated SSD. A good test for PiTubeDirect perhaps!

User avatar
BigEd
Posts: 2058
Joined: Sun Jan 24, 2010 10:24 am
Location: West
Contact:

Re: Any short type-ins for unattended Beebs?

Post by BigEd » Mon Apr 09, 2018 9:12 pm

(Thanks for the flowers too!)

User avatar
lcww1
Posts: 274
Joined: Wed Mar 15, 2017 11:16 pm
Location: Moon Base Alpha
Contact:

Re: Any short type-ins for unattended Beebs?

Post by lcww1 » Mon Apr 09, 2018 9:30 pm

BigEd wrote:Ambitious! I've a feeling it overplots: I*2 should perhaps be I*4? In which case other things might perhaps be usefully rescaled?
Yes, I think I*4 looks better :) :
Bifurcation2.png
With I*4

User avatar
FourthStone
Posts: 556
Joined: Thu Nov 17, 2016 2:29 am
Location: Melbourne, Australia
Contact:

Re: Any short type-ins for unattended Beebs?

Post by FourthStone » Tue Apr 10, 2018 9:47 am

Oldie but a goodie, on tape image but could be easily transferred to DSD.

https://www.stairwaytohell.com/bbc/arch ... hics_B.zip

I remember running these BITD :-D

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

Re: Any short type-ins for unattended Beebs?

Post by AndyF » Tue Apr 10, 2018 12:19 pm

I'm slighty confused (sorry) how to run the programs on the .ssd , if I exec them the output (input) is not in a suitable form it seems. Do I need to Spool them or something ? Sorry! :oops: :oops: :oops:

I've seen some wonderful routines so far, as others have said a brilliant topic =D>
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
BigEd
Posts: 2058
Joined: Sun Jan 24, 2010 10:24 am
Location: West
Contact:

Re: Any short type-ins for unattended Beebs?

Post by BigEd » Tue Apr 10, 2018 1:10 pm

I'm hoping that you can NEW, then *EXEC a file, and then RUN the program.

Post Reply