Direct Links to In-Browser Demos

for discussion of bbc basic for windows/sdl, brandy and more
Deleted User 9295

Direct Links to In-Browser Demos

Post by Deleted User 9295 »

After my presentation on Saturday it was evident that there was a little bit of confusion over the capabilities of the in-browser edition of BBC BASIC for SDL 2.0. I thought it might be helpful to publish a set of direct links to the many existing demos; most can be reached by navigating the menus but this provides a one-click route.

You will need either a desktop browser (e.g. Brave, Chrome, Edge, Firefox, Opera, Vivaldi, but not Safari) or Chrome for Android with chrome://flags/#enable-webassembly-threads enabled. A few of these are a little slow, because they pull in resource files from the web, but most load quite quickly:

Games:
  • Rubik: 3D animated Rubik's Cube, solves from any starting point.
  • 2048: Number-doubling sliding-block game.
  • animal: Guess the Animal 'learning' game.
  • buggy: Steer the buggy and collect points.
  • cowboy: David Williams' Cowboy Shootout GFXLIB demo.
  • dibley: Help Dibley the cat escape.
  • dropperz: Aliens drop bombs (and gifts)!
  • hangman: The popular word-guessing game.
  • gorillas: David Williams' adaptation of the QBasic Gorillas game.
  • hanoi: Solves the Towers of Hanoi problem.
  • jigsaw: A full-featured jigsaw puzzle, includes piece rotation.
  • lemmings: Guide the lemmings home.
  • snake: David Williams's version of the well-known game.
  • sudoku: Solve Sudoku puzzles.
  • tower: David Williams' Treasure Tower (Maisie Bones subgame).
  • triples: Match the wooden items (sliding-block puzzle).
General:
  • Ceefax: Simulates the BBC's teletext service, with live data.
  • SkyBaby: A 'planetarium' program for astronomy.
  • banner: Scrolls a text banner across the screen.
  • bezierfit: Fits a Bézier curve to a set of points.
  • calendar: A perpetual calendar.
  • dlgdemo: Demonstrates a dialogue box.
  • ellipsefit: Fits an axis-aligned ellipse to four points.
  • kerning: Demonstrates kerning.
  • mode7dem: Demonstrates the MODE 7 emulation.
  • multitouch: Tracks touch points (requires a touchscreen).
  • optics: Wave incident on a film-covered dielectric.
  • poem: Roger McGough's poem from the Welcome Tape.
  • polyfit: Fits a polynomial to a large set of data points.
  • prompter: Vertically smooth-scrolling text.
  • saa505x: Demonstrates the different MODE 7 character sets.
  • scroll: Scroll across a large graphics canvas.
  • solve: Solve simultaneous linear equations.
  • sortdemo: Demonstrates different sorting algorithms.
  • unicode: Proportional-spaced text in different languages, including Hebrew and Arabic.
Graphics:
  • aagfxdem: Demonstrates anti-aliased graphics.
  • aliens: Multiple scaled and rotated sprites with shadows.
  • bbcowl: The BBC's 'rotating world' logo.
  • bounce: Bouncing balls.
  • chain: A moving chain of balls.
  • clock: A realistic analogue clock.
  • colorcycle: Simulates 'palette animation'.
  • disco: Flashing squares like a disco floor.
  • doodle: Doodle with the mouse.
  • ellipses: Rotating outline and filled ellipses.
  • fern: A fractal fern leaf.
  • fire: Simulated bonfires.
  • flier: A wire-frame flying object.
  • flood: Demonstrates flood-filling.
  • fluid: A plasma-like fluid (shader demo).
  • jclock: A mouse-following clock.
  • kaleidoscope: A kaleidoscope-like display.
  • knots: Celtic Knot style patterns.
  • lighting: Demonstrates 3D lighting.
  • mandel: The Mandelbrot Set (shader demo).
  • penrose: The Penrose Stairs illusion, with sound.
  • persian: The Persian Carpet demo from the Welcome Tape.
  • piechart: Draws a piechart in perspective.
  • polydots: Chasing dots.
  • polygon: Polygons, from the Welcome Tape.
  • pyramid: A tumbling 3D pyramid, with texture mapping.
  • raytrace: Raytracing shader demo.
  • saucer: A flying-saucer like graphic.
  • scarab: A graphic resembling a scarab beetle.
  • seascape: A synthetic seascape (shader demo).
  • sine: The Sine Wave demo from the Welcome Tape.
  • sliderule: An animated sliderule.
  • slitscan: Simulates the 'slit scan' photographic technique (shader demo).
  • snowscene: An animated snow scene, with fractal tree.
  • spectrum: Shows a spectrum of colours.
  • spotlight: Different varieties of 3D lighting.
  • squares: A pattern made by the Exclusive-Or operator.
  • surks: Coloured circles.
  • swirl: Spinning arcs.
  • teapot: A tumbling 3D teapot, with specular reflections.
  • torus2d: Looks like 3D, but drawn with 2D graphics.
  • wheel: A spinning Colour Wheel.
  • world: A texture-mapped rotating 3D globe.
Physics Simulations (Box2D):
  • bbclock: A ball-bearing clock.
  • crates: Crates falling in a heap.
  • dangle: A dangling chain that you can grab.
  • dunebuggy: A vehicle with sprung suspension.
  • lotto: A lottery selection machine.
  • pintograph: A drawing engine made from Meccano.
  • trebuchet: The early siege weapon.
Sounds and Music (need a fast PC for best results):
  • brandenburg: Bach's Brandenburg Concerto No.3, with 3D street organ.
  • carolmedley: A medley of Christmas carols, with 3D Christmas scene.
  • entertainer: Scott Joplin's tune, with animated keyboard.
  • figleaf: Another Scott Joplin ragtime piece.
  • metronome: A working graphical metronome.
  • piano: An on-screen keyboard you can play!
  • polly: Polly, Put the Kettle On.
  • skaters: Waldteufel's Skaters' Waltz, with 3D animation.
  • soldiers: The Parade of the Tin Soldiers, with 3D animation.
  • tocfugue: Bach's Toccata & Fugue in D Minor.
  • widor: Toccata from Widor's Organ Symphony No.5.
Extras (not available via the menus):
  • xd2: David Williams' Xmas Demo II
  • tyoob: David Williams' prizewinning Tyoob game
  • fractal_pyramid: Mesmerising shader demo.
  • conway: Conway's Game of Life (512 x 512 grid).
  • wobbly: A shader demo that's hard to describe!
  • voronoi: Animated Voronoi diagram using shaders.
  • teapot2: A tumbling pewter teapot to show lighting calculations.
  • Alien Eliminator: Another of David Williams's shoot-'em-up games.
  • squishing: DW's 'Bouncing + squishing GFXLIB graphic' demo.
Last edited by Deleted User 9295 on Wed Dec 08, 2021 4:08 pm, edited 5 times in total.
User avatar
BigEd
Posts: 6261
Joined: Sun Jan 24, 2010 10:24 am
Location: West Country
Contact:

Re: Direct Links to In-Browser Demos

Post by BigEd »

Great set of demos Richard! Thanks.

In some cases, I think, it's possible to ESC and then LIST and modify. The Conway Life allows this, and I quite like it.

Having got an in-browser SDL Basic session, with a Basic prompt, is there any way for me to load a program that isn't in the built-in filesystem? I don't seem to be able to paste, for example, or drag-and-drop. (I appreciate that Web technology doesn't always like to interact with the local filesystem, for our safety.) Could I perhaps load a program from a local webserver?
Deleted User 9295

Re: Direct Links to In-Browser Demos

Post by Deleted User 9295 »

BigEd wrote: Mon Jan 11, 2021 1:56 pmIn some cases, I think, it's possible to ESC and then LIST and modify. The Conway Life allows this, and I quite like it.
Generally ESC is trapped, because it's not useful on a mobile platform (Android and iOS) - you can easily end up having to 'force close' the app to regain control - and the in-browser edition is of course running the 'mobile' IDE (touchide.bbc). In an ideal world the in-browser edition would have its own IDE, optimised for that environment. If somebody fancies writing one, feel free; examples/tools/touchide.bbc could be used as a template.
Having got an in-browser SDL Basic session, with a Basic prompt, is there any way for me to load a program that isn't in the built-in filesystem?
Not if you mean a built-in command available at the prompt, no. You could write your own utility or library to do it though, for example based on the loader program that handles the URL parameters (lib/autorun.bbc).
I don't seem to be able to paste, for example, or drag-and-drop.
Browsers insist on running Web Assembly apps in a sandbox, for 'security' reasons; I don't think you can even access the contents of another tab. I believe there is some debate over whether they take this too far, such as not even allowing access to the clipboard. We will have to see how things develop as the technology becomes more mature.
User avatar
BigEd
Posts: 6261
Joined: Sun Jan 24, 2010 10:24 am
Location: West Country
Contact:

Re: Direct Links to In-Browser Demos

Post by BigEd »

Ah, not so easy - never mind, thanks for the info.

(On reflection, I suppose we could use the programs-in-URLs method to load a user program...
Richard Russell wrote: Wed Dec 30, 2020 11:11 pm
I have made sure that the in-browser edition of BBC BASIC for SDL 2.0 can successfully fetch files from Dropbox (using a shared link) so there should be little cause to embed long files in the URL.
)
Deleted User 9295

Re: Direct Links to In-Browser Demos

Post by Deleted User 9295 »

BigEd wrote: Mon Jan 11, 2021 4:13 pm Ah, not so easy - never mind, thanks for the info. (On reflection, I suppose we could use the programs-in-URLs method)
I didn't say it wasn't easy, just that it's not a built-in facility. Handling of URL parameters, including the option of an entire program being embedded, is done in lib/autorun.bbc as I said. It's a perfectly simple, straightforward, program that you could adapt to load files at other times. Saving files to a IP-connected server is another matter, I have no idea how to do that.
User avatar
BigEd
Posts: 6261
Joined: Sun Jan 24, 2010 10:24 am
Location: West Country
Contact:

Re: Direct Links to In-Browser Demos

Post by BigEd »

Richard, not sure where to note this, but your posted sudoku demo finds the T.HARD1 puzzle "Impossible" - unless perhaps I've done something wrong.

Edit: or perhaps the program tries some set of reasoning and isn't able to resolve the answer? In which case it would have found the puzzle "Too hard".

Edit: I thought perhaps this problem is underconstrained - there might be several 'solutions'. If that's it, perhaps the puzzle is "Ambiguous". Edit: But I checked online, and there is a unique solution.

Here's a screenshot:
Screen Shot 2021-02-22 at 14.54.01.png
Deleted User 9295

Re: Direct Links to In-Browser Demos

Post by Deleted User 9295 »

BigEd wrote: Mon Feb 22, 2021 2:55 pm Richard, not sure where to note this, but your posted sudoku demo finds the T.HARD1 puzzle "Impossible"
Hmm. If I run it in BBCSDL in Windows (32-bits or 64-bits x86) it finds the solution, and tells me there is just one. If I run it in Android (ARM) it says it's Impossible. So it looks like the program is sensitive to the CPU type, most likely it has a dependency on 80-bit extended-precision floats, which x86 CPUs have but ARM and WebAssembly don't.

This could be something like a numeric overflow in a chained calculation and quite difficult to track down, so in the meantime I can only suggest that if you want to run the Sudoku program you do so in an x86 edition of BBCSDL (e.g. Windows, Linux, MacOS).


sudoku.png
Deleted User 9295

Re: Direct Links to In-Browser Demos

Post by Deleted User 9295 »

Richard Russell wrote: Mon Feb 22, 2021 3:51 pmThis could be something like a numeric overflow in a chained calculation and quite difficult to track down
Actually a quick glance at the code showed that the explanation is much simpler! When the program was written, back in 2008, the only version of BBC BASIC on which it could run was BBC BASIC for Windows and the only platform it could run on was a (relatively fast) desktop PC. I therefore (unwisely as it turns out) added a time limit - ten seconds - after which if it hasn't found a solution it assumes there isn't one.

Now there are a much wider selection of platforms on which it can run, some of which are quite slow. That 10 second limit isn't appropriate any more, but it's still in the code. If you comment out this line in FNsolve you should find that it works:

Code: Select all

          IF TIME > 1000 EXIT FOR
User avatar
BigEd
Posts: 6261
Joined: Sun Jan 24, 2010 10:24 am
Location: West Country
Contact:

Re: Direct Links to In-Browser Demos

Post by BigEd »

Ah, a simple fix - hurrah! (I don't see how to modify the Basic program in the browser version, although I can LOAD and LIST.)
Deleted User 9295

Re: Direct Links to In-Browser Demos

Post by Deleted User 9295 »

BigEd wrote: Mon Feb 22, 2021 4:54 pmI don't see how to modify the Basic program in the browser version
You can edit it (either using the GUI editor in the IDE or the traditional way at the immediate mode prompt) but it won't achieve very much because the next time you run it it will fetch the old version from my web site again! To make a local edit 'stick' you would first have to copy the program into the @usr$ folder and then edit that local copy. Probably easier to wait until I update it my end.
Soruk
Posts: 1136
Joined: Mon Jul 09, 2018 11:31 am
Location: Basingstoke, Hampshire
Contact:

Re: Direct Links to In-Browser Demos

Post by Soruk »

BigEd wrote: Mon Feb 22, 2021 4:54 pm Ah, a simple fix - hurrah! (I don't see how to modify the Basic program in the browser version, although I can LOAD and LIST.)
You should find the line using

Code: Select all

LISTIF EXIT
...then just delete the line by entering its line number only.
Matrix Brandy BASIC VI (work in progress) The Distillery (another work in progress) Note Quiz (New educational software for the BBC and modern kit)
BBC Master 128, PiTubeDirect (Pi 3B), Pi1MHz, 5.25+3.5in dual floppy.
User avatar
BigEd
Posts: 6261
Joined: Sun Jan 24, 2010 10:24 am
Location: West Country
Contact:

Re: Direct Links to In-Browser Demos

Post by BigEd »

Ah - I see that RENUMBER would then let me change a line. (As far as I can tell, line editing is all I have, in the browser.)

But I also see that you've removed the timeout already - thanks Richard!
Deleted User 9295

Re: Direct Links to In-Browser Demos

Post by Deleted User 9295 »

BigEd wrote: Mon Feb 22, 2021 5:19 pmAs far as I can tell, line editing is all I have, in the browser.
You also have the GUI editor in the IDE, which is how I modified it here to demonstrate that removing the timeout fixed the problem. As I said earlier in this thread the in-browser edition uses the same IDE as the Android and iOS editions and has the same features, although it is primarily intended for use with a touchscreen (which I do have here on this laptop). But it should be usable using the keyboard and mouse as well.
User avatar
BigEd
Posts: 6261
Joined: Sun Jan 24, 2010 10:24 am
Location: West Country
Contact:

Re: Direct Links to In-Browser Demos

Post by BigEd »

Hmm, I feel I must be missing something. If I invoke touchide, I get the file browser. If in the file browser I click on sudoku.bbc, it loads and runs. I have not found a way to edit the source, other than RENUMBER and inputting new or replacement lines. That's fine, if it's so, but it sounds from what you're saying that I could somehow get into a full-screen editor.
Deleted User 9295

Re: Direct Links to In-Browser Demos

Post by Deleted User 9295 »

BigEd wrote: Mon Feb 22, 2021 6:47 pmI have not found a way to edit the source, other than RENUMBER and inputting new or replacement lines. That's fine, if it's so, but it sounds from what you're saying that I could somehow get into a full-screen editor.
What isn't working? Are you not succeeding in opening the 'context menu', or when you select Edit from that menu is it not working? If you have the Android or iOS edition of BBCSDL installed on a phone or tablet, is it working there? I've not had any other reports of it not working.
User avatar
BigEd
Posts: 6261
Joined: Sun Jan 24, 2010 10:24 am
Location: West Country
Contact:

Re: Direct Links to In-Browser Demos

Post by BigEd »

Ah, context menu - I didn't think of that, didn't expect one. Yes, that works - thanks!
Deleted User 9295

Re: Direct Links to In-Browser Demos

Post by Deleted User 9295 »

BigEd wrote: Mon Feb 22, 2021 7:11 pm Ah, context menu - I didn't think of that, didn't expect one. Yes, that works - thanks!
So if you didn't find the instructions clear, how would you suggest they be modified? I know they are written primarily from the perspective of a touchscreen on a mobile device, because that's all touchide.bbc was used for until the advent of the in-browser edition. But they do mention the keyboard shortcuts (e.g. Tab to enter the context menu).

I accept - and said as much earlier in the thread - that a dedicated IDE for the in-browser edition, optimised for keyboard/mouse control, would be ideal. But (not surprisingly) nobody has volunteered to write one! I also acknowledge - because it's a complaint made regularly over the decades - that I am hopeless at writing documentation.
User avatar
BigEd
Posts: 6261
Joined: Sun Jan 24, 2010 10:24 am
Location: West Country
Contact:

Re: Direct Links to In-Browser Demos

Post by BigEd »

I think I haven't seen that documentation! Bear in mind, although I was aware of your browser edition from an early stage, most recently I clicked on the links in the head post of this thread. Also, there's no doubt an effect that I didn't know I was missing any information.

Edit: maybe link to the documentation from the top right of the screen, with a Help or a question mark?
Deleted User 9295

Re: Direct Links to In-Browser Demos

Post by Deleted User 9295 »

BigEd wrote: Mon Feb 22, 2021 8:26 pm I think I haven't seen that documentation!
I linked to it in my earlier reply, six posts ago in this thread.

I suspect I've been the victim of a massive wind-up. :?
User avatar
BigEd
Posts: 6261
Joined: Sun Jan 24, 2010 10:24 am
Location: West Country
Contact:

Re: Direct Links to In-Browser Demos

Post by BigEd »

No, no wind up, just my own inattention and, I suppose, over-confidence. My apologies for missing the pointer.

(One must use the context menu, in the file browser: a long press on a touch device, a two-finger-click on a Mac touchpad, or a right-click on a mouse.)
User avatar
lurkio
Posts: 4351
Joined: Wed Apr 10, 2013 12:30 am
Location: Doomawangara
Contact:

Re: Direct Links to In-Browser Demos

Post by lurkio »

Richard Russell wrote: Mon Jan 11, 2021 3:30 pm the in-browser edition is of course running the 'mobile' IDE (touchide.bbc). In an ideal world the in-browser edition would have its own IDE, optimised for that environment. If somebody fancies writing one, feel free; examples/tools/touchide.bbc could be used as a template.
I'm probably being incredibly dense, but I too am slightly baffled: I can get to touchide.bbc in the "file browser", but when I click on it nothing really happens -- the screen refreshes and then nothing. Even if I right-click to display the context menu, I can't then seem to click on "Open" -- or, rather, if I do, nothing happens.

Screenshot 2021-02-22 at 21.35.39.png

:?:

EDIT: Ah! You have to right-click on the program you want to edit and then click "Edit". Got it!

#-o
Deleted User 9295

Re: Direct Links to In-Browser Demos

Post by Deleted User 9295 »

lurkio wrote: Mon Feb 22, 2021 9:36 pmI can get to touchide.bbc in the "file browser"
I'm not sure what you mean by "can get to": examples/tools/touchide.bbc is the program that runs initially in the Android, iOS and in-browser editions. It's also the program the examples CHAIN on pressing ESCape.
I can't then seem to click on "Open" -- or, rather, if I do, nothing happens.
What browser? It works on those I've tried, but it sounds like something isn't working on the one you're using. If you have a different browser available, try that.
User avatar
lurkio
Posts: 4351
Joined: Wed Apr 10, 2013 12:30 am
Location: Doomawangara
Contact:

Re: Direct Links to In-Browser Demos

Post by lurkio »

Richard Russell wrote: Mon Feb 22, 2021 9:44 pm What browser? It works on those I've tried, but it sounds like something isn't working on the one you're using. If you have a different browser available, try that.
I retract my earlier comments -- except for the one about me being dense because I was! Everything's fine. Everything's working as it should. Sorry for the false alarm.

:idea:
Deleted User 9295

Re: Direct Links to In-Browser Demos

Post by Deleted User 9295 »

lurkio wrote: Mon Feb 22, 2021 9:47 pmEverything's fine. Everything's working as it should. Sorry for the false alarm.
I suspect you were thrown by an interface designed for a touchscreen being pressed into service in a browser. I know that's not ideal, but in my judgement it's better than not having any kind of IDE and relying solely on the traditional immediate-mode interface (which is how the early releases of the in-browser edition were).

I can't straightforwardly adapt the IDEs that are used for the desktop editions (Andy Parkes's BBCEdit and my SDLIDE) to run in a browser because they depend on being able to execute your BASIC program in a separate process and a separate window. So the only entirely satisfactory solution would be to write yet another IDE specifically for the in-browser edition.

Unfortunately I lack the energy, and no longer have the skill, to do that.
User avatar
lovebug
Posts: 1739
Joined: Sun Jan 31, 2021 5:07 pm
Location: Magrathea
Contact:

Re: Direct Links to In-Browser Demos

Post by lovebug »

sorry I crashed the teletext demo :(
screenshot.png



------------------- edit ----------------------------
oh its fine , refreshing the page is good again. sorry I panicked for no reason :oops:
Image Image Image Image
Deleted User 9295

Re: Direct Links to In-Browser Demos

Post by Deleted User 9295 »

lovebug wrote: Mon Feb 22, 2021 10:28 pm sorry I crashed the teletext demo :(
I hate non-repeatable errors, they are so hard to debug. My guess would be that when the program tried to download one of the BBC's RSS feeds it received corrupted data of some kind, and the error resulted when the program tried to parse it as XML. It probably means an ON ERROR LOCAL statement needs to be added to protect against that eventuality, but without the fault being reproducible it's hard to know where.

This is not meant as an excuse, but I know that one of the major impacts of my 'illness' is that code I write now is much more likely to contain bugs than it would have been a few years ago. I am constantly frustrated at my own failings in that regard, which is one reason why I've decided not to write any more 'serious' programs. Mind you, even making minor edits to existing code is prone to stupid errors.

I have had a new version of BBC BASIC for Windows 'ready to go' for some months, but I'm scared to release it for fear of possible regressions. :cry:
User avatar
lovebug
Posts: 1739
Joined: Sun Jan 31, 2021 5:07 pm
Location: Magrathea
Contact:

Re: Direct Links to In-Browser Demos

Post by lovebug »

actually I stupidly mistyped a page number as 010 it crashes every time
Image Image Image Image
Deleted User 9295

Re: Direct Links to In-Browser Demos

Post by Deleted User 9295 »

lovebug wrote: Mon Feb 22, 2021 10:59 pm actually I stupidly mistyped a page number as 010 it crashes every time
That at least should be relatively easily fixable, thanks for the report.
Deleted User 9295

Re: Direct Links to In-Browser Demos

Post by Deleted User 9295 »

Richard Russell wrote: Mon Feb 22, 2021 11:03 pm That at least should be relatively easily fixable, thanks for the report.
  1. I've fixed Ceefax.bbc so that it doesn't abort if you enter a page number with a leading zero.

  2. I've restored the timeout to sudoku.bbc, but only when you select Count rather than Solve (otherwise Count could take a very long time if the puzzle is highly under-constrained).
Deleted User 9295

Re: Direct Links to In-Browser Demos

Post by Deleted User 9295 »

I've added the pewter teapot example to the list of in-browser demos.

Post Reply

Return to “modern implementations of classic programming languages”