OpenAI ChatGPT, artificial intelligence to write programs in Basic of the Commodore 64, C64, cover

BASIC program written by artificial intelligence

Read in: IT 🇮🇹   EN 🇺🇸

L'intelligenza artificiale ChatGPT OpenAI is able to write a program in BASIC for the Commodore 64?

Subscribe my YouTube channel ValorosoIT. Retro technology, vintage audio, retro computers, experiments and tests. Retroprogramming, Basic. Commodore, IBM, Atari, Apple, Texas Instruments, Amstrad, MSX.

Try!

In This short video, I recorded the first attempts. I requested two programs in BASIC for the Commodore 64: a FOR cycle and, then, also a more complex programme.

Il risultato è stato ottimo, anche se ho riscontrato un paio di errori nel programma più complesso: il gioco "sasso, carta, forbice". La scelta del secondo programma ("sasso, carta, forbice") è stata a discrezione dell'intelligenza artificiale Chat GPT-3.

Ripetiamo l'esperimento: chiediamo dei programmi in BASIC all'intelligenza artificiale

From the ChatGPT main page, we request a BASIC program for the Commodore 64, which contains a FOR loop. Although I request the program using the English language, you can also use your native language.

OpenAI ChatGPT, artificial intelligence, Chat GPT 3, write program in BASIC for Commodore 64, C64

To learn how to use ChatGPT, you can refer to this article.

OpenAI ChatGPT, artificial intelligence, Chat GPT 3, write a program in BASIC for Commodore 64, C64, FOR cycle

The program listing is as follows, very simple.

10 FOR I = 1 TO 10
20 PRINT I
30 NEXT I
40 END

In sé, il programma funziona bene e non ha problemi. E' superflua la riga 40, dato che il programma sarebbe terminato ugualmente, anche senza l'istruzione END. Vediamo l'esecuzione del programma sull'VICE emulator for Commodore 64.

ChatGPT artificial intelligence, Chat GPT 3, program in BASIC for Commodore 64, cycle FOR

Programma in BASIC: "sasso, carta, forbice"

Per complicare un po' la vita all'intelligenza artificiale Chat GPT di Open AI, ho richiesto un programma più complesso. Il primo tentativo, è quello che abbiamo visto nel video breve. Non funzionava immediatamente. Successivamente, ho riprovato a chiedere il programma del gioco "sasso, carta, forbice". In questo caso, il programma funziona senza problemi.

Follow me on Instagram channel. Retro technology, Commodore, vintage audio, retro computers, experiments and tests. Retroprogramming, Basic. Commodore, IBM, Atari, Apple, Texas Instruments, Amstrad, MSX.

OpenAI ChatGPT, artificial intelligence, Chat GPT 3, write program in BASIC for C64, scissors card stone game

The program listing is as follows:

10 PRINT "ROCK, PAPER, SCISSORS!"
20 INPUT "YOUR CHOICE (R/P/S)"; A$
30 IF A$ = "R" THEN PRINT "ROCK": GOTO 60
40 IF A$ = "P" THEN PRINT "PAPER": GOTO 60
50 IF A$ = "S" THEN PRINT "SCISSORS": GOTO 60
55 PRINT "INVALID CHOICE, TRY AGAIN"
56 GOTO 20
60 REM Computer's choice
70 B = INT(RND(1)*3)
80 IF B = 0 THEN PRINT "COMPUTER CHOSE ROCK"
90 IF B = 1 THEN PRINT "COMPUTER CHOSE PAPER"
100 IF B = 2 THEN PRINT "COMPUTER CHOSE SCISSORS"
110 REM Determine the winner
120 IF A$ = "R" AND B = 0 THEN PRINT "TIE": GOTO 150
130 IF A$ = "R" AND B = 1 THEN PRINT "COMPUTER WINS": GOTO 150
140 IF A$ = "R" AND B = 2 THEN PRINT "YOU WIN": GOTO 150
150 IF A$ = "P" AND B = 0 THEN PRINT "YOU WIN": GOTO 180
160 IF A$ = "P" AND B = 1 THEN PRINT "TIE": GOTO 180
170 IF A$ = "P" AND B = 2 THEN PRINT "COMPUTER WINS": GOTO 180
180 IF A$ = "S" AND B = 0 THEN PRINT "COMPUTER WINS": GOTO 210
190 IF A$ = "S" AND B = 1 THEN PRINT "YOU WIN": GOTO 210
200 IF A$ = "S" AND B = 2 THEN PRINT "TIE": GOTO 210
210 END

Il programma è molto interessante, anche perché è stato generato completamente dall'intelligenza artificiale. What will programmers be used for in the future?

A parte la considerazione già fatta relativa all'istruzione END, manca il comando per resettare il generatore di numeri casuali. Questo comando c'era nella prima versione del programma, vista nel video breve. Era errato, ma c'era. In questa seconda versione, manca proprio.

Vediamo l'esecuzione del programma sull'VICE emulator for Commodore 64.

ChatGPT artificial intelligence, Chat GPT 3, program in BASIC for C64 stone scissors paper

Did you like these artificial intelligence experiments paired with the Commodore 64? For more content, you can subscribe to the YouTube channel and activate the notification bell.

Subscribe my YouTube channel ValorosoIT. Retro technology, vintage audio, retro computers, experiments and tests. Retroprogramming, Basic. Commodore, IBM, Atari, Apple, Texas Instruments, Amstrad, MSX.

Posted in Retro Computer, Retro Technology and Vintage Electronics, All articles.

Leave a Reply

Your email address will not be published. Required fields are marked *