Coding with OpenAI

I don’t know if anyone here has had code written by OpenAI before?
I asked it to write a visual tic-tac-toe game in Swift … and after about 20 seconds I got a source code that I could compile in Xcode. Worked perfect. Really amazing.
Now just for fun ask it to write code in Xojo. The answer hilarious. In short, it knows a lot of coding languages but never heard of Xojo. Of course expected.

Anyway, all kidding aside. OpenAI shows that it is perfectly possible to get, even complex things, code written in several programming languages. But knowing that OpenAI is not yet that old does give a good idea of what to expect from it.
OpenAI (and AI in general) may well be the end of all programmers. In other words, we sit on a branch, and we saw it off ourselves. :slight_smile:

I certainly encourage you to play with OpenAI for a while. Ask it to write code for a chess game … it will blow your mind! Trust me.
Also, ask to create an oil painting of a dancing mouse with tutu in the genre of VanGogh. You will be open-mouthed. Really unlikely.
Graphic artists, be warned. :slight_smile:

1 Like

See The images for the new AI tools haven’t been licensed. Therefore, anything you do with those tools is a copyright violation.

For images I use a local running AI via DiffusionBee :wink:
Works great on ARM based Macs.

1 Like

I tend to disagree here.

When I read the OpenAI docs of it, I think everything created by OpenAI is completely license free. But there are still some questions that remain open. What if you ask to make a copy of an existing game …

Anyhow, I have a blast using OpenAI. Just read a nice story.
A student had a thesis written by OpenAI on WWII. The student received a penalty for this and had that penalty written by. … OpenAI. Great right? :rofl:

1 Like

On DeviantArt I have some photos of my garden and some fractals. Instead of asking for permission to use the images DeviantArt scraped all images without consent. It’s only possible to opt-out for future images that I upload to DeviantArt. The opt-out was really obscure. If that is not copyright violation then I don’t know what copyright violation is.

I don’t think DeviantArt uses OpenAI and from what I understand, DeviantArt does not uses neural network as OpenAI does.

Edit: It seems DeviantArt does use neural network too. But not OpenAI’s (which supposes to be the best by far).

I asked chatgpt to write code for xojo, and it knew it.
seems anyway that it was only knowing of api1, some explainations of api2 were more “vague”…

write a small xojo code to sort a random array of 10 integers
Here's some sample code that will sort a random array of 10 integers using Xojo:

Dim array(10) As Integer
For i As Integer = 0 To 9
    array(i) = Rnd * 100

For i As Integer = 0 To 9
This code declares an array of 10 integers, then fills it with random numbers between 0 and 100 using a For loop.
Then it sorts the array using the Sort() method of the array.
Finally, it uses a second For loop to display each element of the sorted array using a message box.
You can also sort the array in descending order by using the Sort() method with an argument of -1.

Copy code
You might also need to import the Xojo framework by adding the following line at the top of your code:
Import Xojo

Copy code
You can also use other sorting algorithm such as Bubble sort, insertion sort, quicksort, and so on for sorting the array as well.

Odd, here it says it has no knowledge of Xojo.
Will install the ChatGPT app. Maybe that’s different.

Trained up until point in time. No mystery here

Why would it be different. Last I heard there was no API so it is what it is

Instantly we know this lawsuit is doomed to failure. Their claim about being trained from other works is the same as human artists - they all kearn from past artists / masters.

Grandstanding and fearmongering at best.

Move on.

1 Like

These are not AI.

Ask more complex question (try something that does not already exists), and if you get a decent aswer, this may be AI.

Until that, I will say these are “Google like answer”.

Same as you learned things from you parents, school and Google. AI is about neural network, like the human brains work.

Take an example from Alpha Go (deep mind). This AI is proof that it can think 100% the same as a human brain. Maybe you do not know the game GO, but not like chess, you cannot win just by using tactics, schemes, combinations, etc… The game GO needs very good creativity to win at a high level. Last year Deepmind finally cracked this. The AI could learn itself to play GO starting from scratch (read: input was only the rules … nothing more).

I asked it to write a visual tic-tac-toe game in Swift
Excepted if you can read the OpenAI code and not find a tic-tac-toe game in Swift, you can say that…

As you wrote above, intelligence means “I do not knew the answer before someone ask me the question, and so, I gave using my intelligence an answer”.

To test that, one have to ask a question the programmer cannot think at (and therefore cannot program an answer).

Now, you may are right / I can be wrong because I do not have enough data to give a true (think definitive answer) as of today concerning AI.

When I really want the most correct answer, I try to avoid answers element in my question. Example:

We don’t do this

is a bad question because the answer wil be No if the questioned person do not know.

But, if you ask “Do we do this ?”, the questionned person is in trouble and better ask someone who knows (instead of saying “No”, the by default answer).


B TW: I do not know GO nor Chess, but I think people can program each and every play (difficult, but doable); this, a human cannot do (thing all - say 256, 512, 1024 or more - next plays). The program power is the programmer’s power.
Once computers will be able to do Select Case by themselves… it will be the AI age. Until then.

Facial recognition is not AI. IMHO

The famous ‘move 37’ on a Go game against the world champion is now considered that AI can think like a real brain. You definitely need to see the documentary of that.

Here is a link: AlphaGo - The Movie | Full award-winning documentary - YouTube
Just watch it from second 1 to the end. No skipping. It will blow your mind and think different what AI can do now.

(If I am wrong, I am wrong, there is nothing more to say.)

what do you know about xojo ?

ChatGPT answer :

Xojo is a software development tool that allows developers to create cross-platform desktop, web, and mobile applications using a single codebase. It uses a language called XojoScript, which is similar to other popular programming languages such as Visual Basic and Java. It is popular among developers for its ease of use, and its ability to create native apps for multiple platforms with one codebase. It has been in development and use since 1998.

I’m using the online chatgpt at

there can be some odd answers though…

write a websdk code for xojo that display a button with fontawesome icons in it

Here is an example of a web SDK code for Xojo that creates a button with a FontAwesome icon inside of it:

' Import the necessary web modules
Import WebControls
Import WebFontAwesome

' Create a new button
Dim myButton As New WebButton

' Set the button text to the FontAwesome icon code
myButton.Text = WebFontAwesome.Icon("fa-check")

' Add the button to the web page

You need to import the webcontrols and webfontawesome modules for this code to work. This code creates a new button, sets the text of the button to the FontAwesome icon code for a checkmark, and then adds the button to the web page.

Please note that this code is just an example, you will have to adjust it according to your needs and also make sure that you have the fontawesome webfonts and css linked to the page.

it even works in french !

en utilisant xojo, faire un programme qui interroge la table “clients” d’une base de données sqlite et retourne le nom et le prenom du client

Voici un exemple de code qui utilise Xojo pour interroger une table “clients” dans une base de données SQLite et retourner le nom et le prénom du client:

Dim db As New SQLiteDatabase

Dim SQL As String = "SELECT nom, prenom FROM clients"
Dim rs As RecordSet = db.ExecuteSQL(SQL)

Do Until rs.EOF
    Debug.Print(rs.Field("nom").StringValue + " " + rs.Field("prenom").StringValue)


Notez que ceci est un exemple de base, il est important de gérer les erreurs, vérifier que les informations de connexion sont valides et s’assurer que la requête ne soit pas vulnérable aux attaques d’injection SQL.

(ME)> modifier le programme pour tenir compte des injections sql

Voici un exemple de code qui utilise Xojo pour interroger une table “clients” dans une base de données SQLite en utilisant des paramètres pour éviter les injections SQL:

Dim db As New SQLiteDatabase

Dim SQL As String = "SELECT nom, prenom FROM clients WHERE id = ?"
Dim params() As String = Array(id)
Dim rs As RecordSet = db.ExecuteSQL(SQL, params)

Do Until rs.EOF
    Debug.Print(rs.Field("nom").StringValue + " " + rs.Field("prenom").StringValue)


En utilisant des paramètres, nous passons les valeurs à la requête sous forme de paramètres séparés, plutôt que de les inclure directement dans la chaîne de requête. Cela empêche les attaquants d’injecter du code malveillant dans la requête en modifiant les valeurs passées. Il est important de s’assurer que la variable id est correctement sanitized et validée avant d’être utilisée dans la requête.

anyway, even if it’s not perfect, it’s still very impressive that a computer can do that.
lots of simple questions from beginners here on the forum could be sent directly to chatgpt…

1 Like