ChatGPT Hollywood code

You can post your code snippets here for others to use and learn from
Post Reply
amyren
Posts: 352
Joined: Thu May 02, 2019 11:53 am

ChatGPT Hollywood code

Post by amyren »

Not so surprisningly, ChatGPT / OpenAI is not yet quite able to create fully functiuonal Hollywood code.

I asked it first to create the Hello World code, but every commandline was wrong. It does have a learning function, but even after correcting it and suggested a workinging example (twice), it still insisted in providing that wrong code.

Then I asked it to provide the code for a simple Pong game and this is what I got

Code: Select all

; Pong game in Hollywood

; Set up the window
OpenWindow(0, 0, 300, 200, "Pong", #PB_Window_SystemMenu)

; Variables for ball position and velocity
BallX = 150 : BallY = 100
BallVX = 2 : BallVY = 2

; Variables for paddle positions
Paddle1Y = 75 : Paddle2Y = 75

; Main game loop
Repeat
    ; Clear the screen
    ClearScreen()

    ; Move the ball
    BallX = BallX + BallVX
    BallY = BallY + BallVY

    ; Bounce the ball off the top and bottom walls
    If BallY < 0 Or BallY > 190
        BallVY = -BallVY
    EndIf

    ; Check for paddle collisions
    If BallX < 20 And BallY > Paddle1Y And BallY < Paddle1Y + 50
        BallVX = -BallVX
    EndIf
    If BallX > 280 And BallY > Paddle2Y And BallY < Paddle2Y + 50
        BallVX = -BallVX
    EndIf

    ; Check for scoring
    If BallX < 0
        MessageRequester("Player 2 wins!", "Score")
        BallX = 150 : BallY = 100
    EndIf
    If BallX > 300
        MessageRequester("Player 1 wins!", "Score")
        BallX = 150 : BallY = 100
    EndIf

    ; Draw the ball
    DrawCircle(BallX, BallY, 5, #PB_Pixel_Red)

    ; Draw the paddles
    DrawRectangle(10, Paddle1Y, 10, 50, #PB_Pixel_White)
    DrawRectangle(280, Paddle2Y, 10, 50, #PB_Pixel_White)

    ; Move the paddles with the mouse
    Paddle1Y = MouseY() - 25
    Paddle2Y = BallY - 25

    ; Update the screen
    UpdateWindow()

Forever
Next, I did work through the code and tried to make a working code out of it while changing as little as possible
I have commented the non-working lines and created the working code below each line

Code: Select all

; Pong game in Hollywood

; Set up the window
;OpenWindow(0, 0, 300, 200, "Pong", #PB_Window_SystemMenu)
@DISPLAY{Y = 0, X = 0, WIDTH=300,HEIGHT=200, Title = "PONG"}

; Variables for ball position and velocity
;BallX = 150 : BallY = 100
BallX = 150 
BallY = 100

;BallVX = 2 : BallVY = 2
BallVX = 2 
BallVY = 2

; Variables for paddle positions
;Paddle1Y = 75 : Paddle2Y = 75
Paddle1Y = 75
Paddle2Y = 75


; Main game loop
Repeat
    ; Clear the screen
    ;ClearScreen()
    Cls

    ; Move the ball
    BallX = BallX + BallVX
    BallY = BallY + BallVY

    ; Bounce the ball off the top and bottom walls
    If BallY < 0 Or BallY > 190
        BallVY = -BallVY
    EndIf

    ; Check for paddle collisions
    If BallX < 20 And BallY > Paddle1Y And BallY < Paddle1Y + 50
        BallVX = -BallVX
    EndIf
    If BallX > 280 And BallY > Paddle2Y And BallY < Paddle2Y + 50
        BallVX = -BallVX
    EndIf

    ; Check for scoring
    If BallX < 0
        ;MessageRequester("Player 2 wins!", "Score")
	SystemRequest("Player 2 wins!", "Score", "OK")
        ;BallX = 150 : BallY = 100
	BallX = 150
	BallY = 100
    EndIf
    If BallX > 300
        ;MessageRequester("Player 1 wins!", "Score")
	SystemRequest("Player 1 wins!", "Score", "OK")
        ;BallX = 150 : BallY = 100
	BallX = 150
	BallY = 100
    EndIf

    ; Draw the ball
    ;DrawCircle(BallX, BallY, 5, #PB_Pixel_Red)
    Circle(BallX, BallY, 5, #RED)

    ; Draw the paddles
    ;DrawRectangle(10, Paddle1Y, 10, 50, #PB_Pixel_White)
    Box(10, Paddle1Y, 10, 50, #WHITE)
    ;DrawRectangle(280, Paddle2Y, 10, 50, #PB_Pixel_White)
    Box(280, Paddle2Y, 10, 50, #WHITE)

    ; Move the paddles with the mouse
    Paddle1Y = MouseY() - 25
    Paddle2Y = BallY - 25

    ; Update the screen
    ;UpdateWindow()
    VWait()
Forever
The example above is the result I got a couple of days ago. I do not remember the exact question I asked to get the reply about, but when I tried today to replicate the question it gave me a different code that I suspcet was much closer to the C language.
Bugala
Posts: 1178
Joined: Sun Feb 14, 2010 7:11 pm

Re: ChatGPT Hollywood code

Post by Bugala »

I tried OpenAI as well to create some code to Hollywood, but realised right away it wouldn't really work very well.

There needs to be more written about Hollywood in Interne for OpenAI to have stuff to learn it from.

Right now best option is to ask it to make LUA-code, and then change that code into Hollywood yourself. It is very unfortunate this is the situation, since I would have used OpenAI a lot for my Hollywood coding needs otherwise. It could have speeded up programming a whole bunch, and especially help in doing new things.
User avatar
Juan Carlos
Posts: 887
Joined: Mon Sep 06, 2010 1:02 pm

Re: ChatGPT Hollywood code

Post by Juan Carlos »

But ChatGPT knows what is Hollywood programming language? I think not, it cans know C, Python, the languagues more knows.
amyren
Posts: 352
Joined: Thu May 02, 2019 11:53 am

Re: ChatGPT Hollywood code

Post by amyren »

I asked it to tell me about the Hollywood programming language, this is the reply

Code: Select all

I'm sorry, but there is no programming language called "Hollywood". It's possible that you may be referring to the multimedia framework with the same name that runs on AmigaOS and Linux systems. Hollywood is designed for creating cross-platform applications and games with graphics, sound, and animations. It supports a high-level scripting language for easy and fast development, and also allows the use of C or C++ for more demanding tasks.
It seem to "evolve" from day to day.
I asked it again to give me a Hello World program, now it looks like this

Code: Select all

; A simple "Hello World" program in Hollywood

Print("Hello World!")
Bugala
Posts: 1178
Joined: Sun Feb 14, 2010 7:11 pm

Re: ChatGPT Hollywood code

Post by Bugala »

thats interesting. Thought their data is only up to 2021, so didnt expect it to get forward until they update next year in it or something.

One possibility for your correct hello world program could also be that there is bit of a random factor in its answers. To make surer (not sure even this would be sure way to tell) that it is getting forward, would be to take the random factor out (I think there is option like that on OpenAI) and see if result keeps changing.
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: ChatGPT Hollywood code

Post by airsoftsoftwair »

Haha, that's quite amusing. That "Hollywood" code that ChatGPT originally created looks a bit like PureBasic to me which is not even so surprising because the syntax of PureBasic and Hollywood is somewhat similar because both were influenced by BlitzBasic2. Apparently, ChatGPT has recognized this similarity between the languages and has come up with a mish-mash between the two.
Post Reply