BBC BASIC Program Generated by ChatGPT
Richard Ashbery (8349) 45 posts |
It looks correct but fails. The following program is from ChatGPT which searches the decimal digits of PI to find the “999999” sequence. Mathematicians amongst you will know it is the Feynman point. Not being a mathmatician I’m stuggling to understand the so called spigot algorithm in lines 90-190. Can anyone explain in simple terms and if you can make the program work that would be a bonus. I’ve found quite a few examples that fail – even mixing BBC BASIC with keywords that don’t exist. 10 REM Feynman Point Finder in BBC BASIC |
Steve Fryatt (216) 2112 posts |
It might help if you posted that as a code block, so that textile doesn’t “improve” the contents… prefix the first line with
to create a multi-line code block. If you wanted to follow on with plain text again, you could prefix the first non-code line with |
Simon Willcocks (1499) 540 posts |
Does that code even have something that calculates pi? Change it to simply print pi. I’d be surprised if it was better than 22/7. |
Steve Fryatt (216) 2112 posts |
It’s very rough, and I’ve not debugged it, but going by this I suspect this is what the code is trying to do.
|
David J. Ruck (33) 1649 posts |
We know AI is shit, so please don’t post any of it’s output here. |
Steve Fryatt (216) 2112 posts |
Hopefully that wasn’t aimed at the code which preceded it… It’s an interesting demonstration of just why AI isn’t there quite yet, especially for languages like BBC BASIC. Richard’s code is almost like BASIC written by someone who thinks it’s just another dialect of Python, or something. The Feynman part appears to “functional” aside from completely ignoring the fact that strings are limited to 255 characters, for instance, and apparently trying some kind of slicing or array indexing on them – very C# or Pythonesque. On the other hand, the Spigot algorithm contains
which is close to what I wrote, but then
which is clearly no substitute for
if only because it hasn’t realised that reals aren’t integers… |
David J. Ruck (33) 1649 posts |
It’s a statistical word guesser, it will never understand what is correct code and what isn’t. Let’s keep this platform free of it’s pollution. |
Rick Murray (539) 13907 posts |
I will point you towards https://heyrick.eu/blog/index.php?diary=20230920 It seems to me that tools such as these are useful for explaining concepts when you don’t quite grok an idea; but there’s a vast gulf between concepts and functional code. I thought I’d written up about the mess it made when asked to make a raycaster in BASIC (wrong keywords, code that was gibberish to the point I gave up trying to understand it) but I guess I didn’t… Maybe I’ll do it again soon and make an article out of it. |
Raik (463) 2067 posts |
I’m too lazy to look closely at what the generated code does. But I think I recognized a few small errors when I took a quick look at it. Note: It will be very slow with bigger digits of Pi. Any days for 10^6 ;-) |
Richard Ashbery (8349) 45 posts |
I didn’t think it would generate so much interest but thanks for all your replies. The other thing (I really shouldn’t be surprised) is how dogmatic and uncompromising (I love this word) some people are. Thanks to Steve and Raik who put effort into providing a solution and again to Steve for the tip about posting inside code block. I’ll have a look at your examples – the spigot algorithm is not simple to understand but maybe going through your ideas might help. Don’t worry I won’t be posting anything from ChatGPT again as I find it ends up rendering code that bamboozles me even more – was it hallucinating I wonder? |
Rick Murray (539) 13907 posts |
I think some of us see very very strong parallels with the dot com boom all those years ago. Honestly I don’t care either way, but I’d like to see three things: 1, An actual viable use case for LLMs, and not everybody falling over themselves to shove it in to everything they can because they can. They are interesting toys, but I sure as hell wouldn’t trust one to review a police bodycam and write a report summarising what happened (yes, really…). 2, Proper attention to data hygiene around the use of LLMs. If one, for example, is helping you get fitter by creating custom routines according to your time and effort, is this information being shared with any third parties? If so, who and why? (and I’m counting so-called anonymised information here) 3, A proper resolution to the question of why ten seconds of a song in the background of a video of a copyright strike, yet these AI companies can grab a copy of everything in sight, mash it up with everything else, and make loads of money claiming it’s something shiny and new rather than a regurgitation of everything that they, essentially, stole (if one is to apply as strict an interpretation of copy/moral rights as the content companies wish to apply to us). |
Richard Ashbery (8349) 45 posts |
I’m still working my way through your examples. Raik you’ll be pleased to know that both your examples work really well with the second example showing precisely how many decimal digits must be counted before the “999999” sequence starts which mathematicians will know as 762. Both examples seem reasonably fast on a R-Pi4 machine with processing 10,000 iterations taking approx. 2min. I think 10^6 would be pushing it! I wonder what other interesting sequences exist in Pi? I did hear of a 12345678 sequence (might have a 9 in it but can’t remember) 3 good points Rick – difficult to argue with them! |
David J. Ruck (33) 1649 posts |
Dogmatic and uncompromising ensures:-
AI will never be involved in the writing of high integrity software as long as there is breath in my body. |
mikko (3145) 125 posts |
That’s fine as a personal opinion but any RISCOS related subject should be up for discussion on this forum; and for some people, that includes AI. |
Steve Pampling (1551) 8198 posts |
Carbon fibre shell – meet Alex; Alex Albon, licensed to destroy. :) |
Raik (463) 2067 posts |
On position 17.387.594.880 should be 0123456789 but I will not try it ;-) You can try a C version without Feynman-search. Is much faster. |
Rick Murray (539) 13907 posts |
In case it interests anybody, a long meandering article that skewers “AI”. Includes dodgy C code, dodgy BASIC code, dodgy attempts at making humans, and a summary of me that is so off-the-wall it has to be seen to be believed. And a bowl of linguine1 which is what I’m about to go and cook… Have fun! https://heyrick.eu/blog/index.php?diary=20241214 1 Makes sense in context, but my regular readers will be used to this sort of thing. |
Alan Williams (2601) 91 posts |
I tried getting version 3 to generate BBC BASIC and the result was abysmal, much worse than above. It occurred to me at the time its highly likely that there would not be much training material about given that its generally a tokenised language, and the bulk of the published source was well before the internet. I was also amused that it thought the alias “THE RAM and BUFFER” for you local boozer was from Douglas Adams and not The Micro User at all. |
Raik (463) 2067 posts |
What do you expect from an “artificial intelligence” that was created by a “natural intelligence” that proves its lack of intelligence every day? |
Raik (463) 2067 posts |
I have upload a small app from my Pistuff. |
Raik (463) 2067 posts |
My App is based on this (? – found the author in my remarks but the code is older) publication and the first I programmed in MSX-Basic. |