PlayBASIC - Does ChatGPT understand PLayBASIC code ?

Started by kevin, January 05, 2023, 03:39:07 AM

Previous topic - Next topic

kevin





Video Transcript:


welcome back by messy Curtis like the rest of the world I've been playing around with this chat gp3
the open AI project and was
amazed at some of the things it can do I want to show you something that even
though it does not know play basic but it does know basic and it does no
programming in general so I write this merge routine for another example is
going to going to post at some point at some point and I was using it doing something else
and I thought well I wonder if it knows what this does
and we'll find out I've already asked this question so I know it actually does know what it is
okay this is uh GPT
uh just go there and and create an account and you're off after the races
so what we'll do is we'll say can you
describe what this code does
oops here
now we haven't changed it's by basic code clearly it doesn't know what playlist is
we'll see what it says
the code is written in a language called Auto hotkey okay
visualize the texturize and fills in random numbers yeah that's what it does
places at the end of the rice check if all are included in the merged output
holy Joy yeah that's true it's exactly why they're there
function is called tests and arguments possible all right uh
uh can you rewrite this code
uh in C for me
this is just how amazing this tool actually is
it's assuming we're passing in a couple of uh arrays
we're passing the sizes in as well I think the loop will be much the same
size lower than this okay
that's over the expression a little bit
it's made simpler look at that
that's the quote I the comment I write sort of arise
compare function
hmm it's pretty impressive
I can do this for a whole bunch of dialects and you can make a you know responses to this uh
uh can you uh
change the code to merge
three arrays and
named array one array two
and build the array
laughs uh when I was initially playing with
this I was just asking it dumb questions and um the responses were were
both funny and kind of frightening at the end
so we're living through checking if
Maybe
yeah that's a Time Saver you know I don't care Who You Are
what language you're using if you can ask it uh arbitrary questions
and get a framework of something even though it's not not going to know your language exactly
like it has no idea what what flavor of icing is hasn't got a clue
but it knows procedural programming
so if you can get you know get to answer your question in a language that's kind of similar I was
plain basic if you want there's a bunch of Basics um
I posted a question off of Facebook actually that someone was asking
it's ended prematurely there but we won't repeat it
uh what do you know about
flavor is it
okay so there's my viewers like so it thinks we're someone else
and I asked this question a few days ago uh who
developed playing basic
wow that's a
it's a different response well I asked it the other day it said that play basic was developed by the gun creators
so now it's saying it's still operator design so it must have improved that
I didn't I didn't actually correct it you can do corrections here but there's up down stuff over here
I was just amazed at even even a response
uh creating Pringles environments they are
no longer in business well it's yeah it's probably true really
partly I guess um all right let's jump back to flight of
icing
this code again
well this thing does actually just takes two sworder to rise
so it makes a right arrays full of random numbers and some values to the end of it into
the arrays and then sort them I did that to make sure that when the when it's copying out the data I'm getting
all of the values from both arrays in the output that's all that's all
I was going to use it for a sorting example but have I've been having too much fun
with messing around with this all right so I'll grab this function
screw the function by itself all right
so can you describe
uh what this function does line by line to
a h
beginner program
oh now you'll know what I mean
I want to find fascinating about this is that it doesn't know PV syntax
so how is it able to read what this is doing
and there are bits of code in here where I guess it's kind of guessing
get array elements that's a play basic thing it's are these is this anywhere else
I still think we should have length if you just go to length and put the array there to give you
the length of that that feels more satisfactory
and there there it is it's a function declares variable I saw as they hold the
realm would say yeah B that's correct so
those two variables yeah inside the loop the function compares the other in
position a to add to them yeah
it's kind of scary um
how wouldn't you rewrite
this function uh to be faster can we ask it that
all right so separated the two things are passed those are the function avoids using a loop variable
goes up to C size makes it fast instantly yeah
iterates are the elements the input arrays or it's using initial Loop counter
um in C yeah that's pretty true what what would happen in um
it says that gets your characters can piled down to where each variable becomes a register on the processor
so less variables in Loops is better uh
that's cool so what else we've got in in here
all right what about Steve's engine
what if we just took um yeah you couldn't pass all this code
there we would have no idea but what if he just took like uh what do we got
right what are the chances of it knowing what
the helmet that's doing all right
so with a subroutine here I'll leave the coins we're doing
intersections with spheres I think that's doing
you know if you're listening to the comment down below I should have read what the what that does
um can you describe what this code so say basic code is doing
let's find out that's my question yeah okay
it's calculating the minimum and maximum x coordinates for 3D sphere object and two-day screen
was that in the comments probably was
occasionally has severiables including minimum Z
I've never said as a few years ago if you want to editor it looks through
all of the objects in the transformed code that performs two nested lobes
it wasn't expecting it to understand what this was but it it should given that character since you know is
um not this particular cover but the syntax of the card is basic light enough
that if I understand it's basic it should be able to figure out what's going on I'm not using anything weird
we just got four next Loop since there's some comparisons and um summarize but it has no idea what these
rides do I can't possibly know what this is all right so I've got that from here
all right so we'll try another function get a code
and I just combine colors anyway back to where
that wasn't the same code which I combine colors
it's not a huge bit of code and
[Music] can you subscribe or this
basic yeah so routine is doing
I don't think I need the quotes but uh
can you speak about the colors of reflections of a three rendering program
if laughs
you just kind of got what um okay
closest to the ray orange and then updates the default car with the closest Reflections color
also updates to reflection strength it also has a variables related to the reflection such as the surface point and
the normals the reflection of the object that reflection hit
fine Returns the opto default color I don't actually know what this function
does myself so that seems okay
so our ref count must be how many Reflections we we have so the row must
be fired out hit something bounce off and then a new race form and we fire off
in that direction and we take on some of the color we've just hit
I don't know um it's been a while I think that's what's
happening with that routine is that we're taking it with every kind of every time we meet the writing hit something
or bounces off it we're blending with that color we're keeping it at least at what colors we've
hit and then blending them all together at some point in at the end to give us our reflection color
Steve um but naturally that does can we just do
this can you write a range tracer
in basic for four weeks
certainly
I don't know what variation advice I could actually yeah now is but
she I think is like a global okay a few times I've seen the shade
using different languages that use expense different things but our type is the same types the same
their materials and so it's interesting is choosing to use procedural basic and not object
orientation so it's kind of knows that what we've
used so far we might try and this this is this is
short enough we might try and actually um get this to work I think visually just we died
I did notice that with some of these examples um
uh can you post the complete code please
wow okay so it was maybe it's designed to abort that given
it's probably too complicated
what if we change tax what if he asked it um to build like a library of math
functions
you know there's there's a gazillion math function libraries but but um
I had the giant loan is helpful getting started running around it okay uh can you
write code uh before
Computing if a array I might have 3D right
uh intersex P spear
in basic so should be sure enough that it's um
this is a summertime employee basically can do
well I think it's basing this off what is just saying
check race for your intersection let's go back and check the code
because I know it's contextual so it will actually refer back to what you were talking about before
the ones I thought were hilarious were I was asking of them uh pop culture references and one of the
it's almost I think it's actually giving us a spinning out um
is it spitting out Steve's routine back to us
no finally discriminate Checkers is negative no intersection
no intersection Phone Solutions
to give in other words because American when it insects
intersects with a sphere there can be two intersection points the one you
imagine a brain just being you know um standing in any direction with your arm pointed
and that arm pointed out was infinite length right and so if you can sort of point up at
the Moon you've got
you know a few different possibilities you've got the ray never intersects the Moon
or it does hit the Moon and you've got a nearsight in section
and a Far Side intersection so because it would just go straight through it
check out the positive sticks occurs on the front of the road uh
complete the code thank you
it's like it's sort of I noticed before with with code is that um it did bug out
a bit but still okay I think if you
knew what you were trying to do kind of like composer quadratic formulas
using a different method
hmm
no we might be pushing it keeps gonna sewing to opt out
nonetheless uh I think it was great it's a pretty impressive tool and I think if we use
um I mean not me you everyone we use these things we can actually get um
to be more and more productive uh
I've actually been using a bit to do to do descriptions of things
as you saw before so
uh what a very simple one so we're talking about math functions before uh how to compute
yeah sorry can you write a function in basic that
computes the distance between
two to 3D points so in other words Paul
yeah just find DX get the square of each square root of H1 that's the end of the
function hmm
what's cool about that is you could kind of go
which is what I find interesting you can kind of go well let's have a let's have it uh
can we go back huh that's the same question uh
it kind of thinks that it's privately it's kind of similar but I think that would
oh no it's gonna add single that would almost work this is a convention that's using uh some Basics by the way some
languages where you return something by assigning uh to the name which always
found kind of annoying because it means if you ever if you ever change the function name you're going to change the return thing
as well it's just like having it after the thing um so that's a 3D version
between two between so we're asking it for a 2d version
but actually we're going to just ask it for a 2d version good way
should should do the same thing it didn't bother unrolling this time
foreign
how uh oh sorry
uh can you write the code to compute a normal uh vector
from a three-day victim uh coming right now I call it a function
you're a function in basic to compute yeah
so I should use syntax but what kind of sim we're familiar with
so we we don't know we get the get the points oh
regenerate sometimes it sort of times out and gets a bit one message at a time please like
a good flight before sending yep okay
original response yeah okay it just gets lost sometimes
fair enough it's very popular so so you find the length so you divide
that into the other sides
oh it's interesting it's going to put them all in the array and spin them out yeah the other end
very cool um since we're talking about vectors
what about uh can you write
code to rotate uh to the
vertex now without rotate and array
artillery vertex uh in basic
so what method uses
whoa look at that Gary elements that's a play basic thing it
the more I talk to it about five Isaac the more it's time to learn foreign
I wasn't expecting that picking up more of
I guess that is only in my con the context of my conversation but um
probably different for other people all right where we got
yeah that looks pretty much like a rotation routine to me
I'm stunned that's chosen these getaway elements because that's a PV thing
that doesn't exist anywhere else at least I don't know if I don't think I exists in other languages I've always
wanted to make that the length to make lengths do much the same thing so it would be a shorter and
oh I you know oh I'm just like like the Visual Basic uses um
I think it's you bound and for upper bound and lower bound or something like that
I'll forget him it's been a while I just I actually just to ask it
yeah compute
number of elements within an array
excuse me uh Visual Basic
new band hmm oh that's different as well it's good
method I guess that would be contemporary Visual Basic
rice can be used get length method yeah hmm oh I'm actually stunned though that does
those things how to how do you compute
the number of array yeah
elements in live Isaac
the prince not supported because we we use the semicolon for comments that's
why that changes there actually
I've always thought about making it optional so old old Co from old listings worked
stay um what does
CLS in play basic do you can't possibly know that right
well I think CLS is actually in basic even old text Basics have a CLS function
the screen is cleared or wow
yeah I wasn't expecting that what about uh
what does end while do you play this
so even though there's brief interactions we're having with it decided to pick up and learn about play
basic you know
picks commands does y biasing include
now showing can't have the answer is
it's drawing more from its experience with basic I mean paints a very old one
what was the Instagram screen there are many other graph line
Graphics related commands of play Basics so you should read the dot rotation for a full set yeah okay
yeah uh I doubt it had I wouldn't have had access to it to anything to chew on to
to learn on those things um but it's just interesting it's hours of
fun you know you could accelerate your own workflow
by just having this running in the background and asking it to do revisions of tax I was trying it to do something
similar with some some YouTube text and descriptions of
things you know give it points you know um
uh could you write a summary
from these points you know it might have
one
uh things I did today I I got up and took down for a walk
uh write code
dog for another walk for uh
went shot went shopping Five
cups tea six and
my YouTube video now surely that's it's ridiculous as
I can't possibly make something useful out of that okay it's giving us back back Point
forms of what we've already done but it's already helped us rewrite that into a more meaningful form so what if he
said um
a longer summary
maybe you're asking it the wrong question but we kind of getting you know but you see what I mean like it can do
can write things uh can write
material for you it can also do summaries of things um
those code like the overview of users of those routines before
incredible
all right so it generated this routine here which rotates a bunch of vertices apparently
um what if we ask it um can you describe this function to
Sun boy uh who's never or somebody who does not
understand programming
subscribe what is function
does to someone who does not want to say a private
you're right so there's an interesting one it's working Radiance and then
so even something like that we can use that to make help more
descriptive posts on the Forum and I've already started to do this a bit of an experiment
can you give more detail maybe that's what I was going to be asked before
right that's that's better
okay I thought I thought this is going to be all this would be all night you know would be perfect but as a starting point
at a Time Saver that it's unbelievable
like that's that's a perfectly decent um thing to post in the forums and
it's fantastic search engine uh Fighter for to get for those keywords because
they're not keywords that I wouldn't normally have used we've got rotation coming through a
bunch of times Y coordinates transformation you know normally I sort of if I write
something like that I would just let the code speak for itself you know maybe if you have a few lines of comments in
between things but you're kind of expecting people though to understand what's Happening Here
what else what a quake loader
wow
let's just grab the whole function now I think we're pushing our lock here
and need to frame frame so drawing a frame vertices
draw a 3D object when I throw drawing a bunch of mesh stuff
clipping it to your rough clip a large triangle section we'll grab a section right
and we'll just see what it thinks about because I want to know what these
structures are I wonder what any of this garbage here is um can you
outline what this what this basic function sorry
Hawaii basic function he is doing
you've got to be cheating
and surely that must be that's inferred that from the variable
name surely it's saying md2 and and load of course triangle section so
the function name is giving it away I would think so
otherwise how on Earth could it possibly know what the what that stuff is doing
wow it's very cool isn't it
imagine normal data draw a frame
all right smarty pants oh
all right smelly pants um
what this function is doing smarty pants
there's an object frame from mot model position
it does by looping through each word actually object for a performance and calculations on XYZ performing it draws
the dot position of screen using the dark thinking man the dot is red and whoa
whoa look at that it it's just deduced that this is a red
RGB color that's correct
but uh how does it know those
perspective even handled in here oh they're just hard-coded I think these are just for uh visualizing the thing
was writing the function
who knows now what's some old stuff
it's a group's example for particles
okay
to a captioning screen doing and doing all the rendering we're doing individual park or entering in this as well I think
I although it might be shapes oh yeah that's probably sharp just to be
honest I would hope so anyway
particle group new group the Light Group spawn
it's going to be show shortly I could write Unix cows
kill it no that's Dot
whoa that says flying dots
with I was assuming it was shapes because um you can do batches of rendering each
shapes with lines and that much faster than doing individual renders that's the point of them
um that's the whole point of that stuff and as we switch to 3D apis you kind of have
to do batch rendering you can't do plot By plot anymore it's just not it's
not worth doing
right but um
see what it thinks about this this will be the last one
ah oops can you describe describe what
what this play basic code is
doing it might be too long I did notice that other things didn't
like them I throw it too long
it makes me wonder if it's getting that thing from the variable names the comments [Music]
[Music] hmm each vehicle is property such as position velocity England space groups
of particles are drawn screen Pockets within the group yeah that that's basically true
uh can you all right good can you
convert the code to Visual Basic
we might four fouls it might be too too long yes
I don't Visual Basic installed in the system to actually find out whether this would give you something that um
compiles and runs but uh yeah it's giving out the guys
but Bravo that's pretty amazing so I suspect if you wanted to convert me
give that code from pretty much anything I reckon
grab a bit of seaco you find out there somewhere or have it simplify something for you grab a function or whatever it's
amazing I just thought I'd show you that if you haven't seen it already jump over there
and mess around with this thing I think you'll enjoy it thanks for watching and we'll see you next time bye

 

kevin

   I've been teaching ChatGPT more about PlayBASIC by pasting in the help files and the results are just stunning.   Basically it's now able to generate working; all be it simple code for PlayBASIC 2d graphics commands..  

  If you want to read how; the conversion is attached bellow.