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

BASIC program written by artificial intelligence

Artificial intelligence 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.

The result was excellent, although I found a couple of errors in the most complex program: the game "stone, paper, scissors". The choice of the second program ("rock, paper, scissors") was at the discretion of the artificial intelligence Chat GPT-3.

Let's repeat the experiment: we ask artificial intelligence for BASIC programs

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 itself, the program works well and has no problems. Line 40 is superfluous, since the program would have terminated anyway, even without the instruction END. Let's see the execution of the program on theVICE emulator for Commodore 64.

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

BASIC program: “rock, paper, scissors”

To complicate life a bit for Open AI's Chat GPT AI, I requested a more complex program. The first attempt, is what we saw in the short video. It didn't work immediately. Subsequently, I tried again to ask for the program of the game "stone, paper, scissors". In this case, the program works without problems.

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

The program is very interesting, also because it was generated completely by artificial intelligence. What will programmers be used for in the future?

Apart from the consideration already made regarding education END, the command to reset the random number generator is missing. This command was in the first version of the program, seen in the short video. It was wrong, but it was there. In this second version, it is missing.

Let's see the execution of the program on theVICE 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.

Do you like this page? Share it:

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 *