Pong game mede with Deepseek AI

You can post your code snippets here for others to use and learn from
User avatar
jPV
Posts: 688
Joined: Sat Mar 26, 2016 10:44 am
Location: RNO
Contact:

Re: Pong game mede with Deepseek AI

Post by jPV »

We'll see... I just wonder why it can't get these kind of basic programming things correct yet, people have been teaching and using it quite a while now with all kinds of programming languages. It's so hyped that there must been massive amount of code and examples fed on these AI things already, and still these kind of elementary things don't go right. I guess there's also bad examples fed/found by AI which directs it to wrong way, so how can we get it "perfect"?

I'm just afraid how code will become bloater than ever when people start to create bigger projects with AI. Hopefully not too many planes crash and people die when people start to trust it makes perfect code :)
plouf
Posts: 613
Joined: Sun Feb 04, 2018 11:51 pm
Location: Athens,Greece

Re: Pong game mede with Deepseek AI

Post by plouf »

jPV wrote: Tue Feb 04, 2025 12:39 pm
I'm just afraid how code will become bloater than ever when people start to create bigger projects with "AI." Hopefully not too many planes crash and people die when people start to trust it makes perfect code :)
This is a defacto . Already we see this with "google technicians" as i call them. Image how sure and confident lower capabilities ppl will become when they ask AI about serious stuff :-)

Allready the massive fake news in social media and fake picture are hidden "AI" fishing strategies imho leading, as you said, who knows where ! :-)

P.s. i vall AI as "AI" because for me is the logic evolution of computer activity, not something brand new
Christos
amyren
Posts: 379
Joined: Thu May 02, 2019 11:53 am

Re: Pong game mede with Deepseek AI

Post by amyren »

plouf wrote: Mon Feb 03, 2025 11:07 pm amazing !
what was your steps /question ?
was as simple as "create me a pong game in hollywood? "


edit to @jpv
you realize that all these "proper code" is human boundaries, for a machine is as simple as everything to be raw in main loop, and the same easier to be in 100 procedures :)
Many steps, but I tried to give it as little help as possible along the way. If giving more detailed instructions in the start, and perhaps a few more hints on the correct syntax I guess it could do it in less steps.
But its the dialogue with the AI that I found entertaining, the resulting code was not the point for me as much as I was curious about if it could do it at all.

I dont remember every question I did to get to the code above, but I tried to recreate it just now to see what happened. The result was slightly different, but I guess I did ask in a different way. First time I did ask it to use sprites instead of clearing the screen with cls all the time and so on. This time I got a simpler game.
Her are the dialogue I made just now:

Code: Select all

Me:
Can you make hollywood code for a pong like game?

Deepseek:
Certainly! Below is a simple implementation of a Pong-like game using Python and the Pygame library. This code is written in a way that is easy to understand and modify, making it a great starting point for learning game development.

Me:
No I was asking for code in the Hollywood programmning language

Deepseek:
Ah, I see! You're referring to the Hollywood programming language, which is a multimedia-oriented scripting language often used for creating games, animations, and graphical applications. Below is an example of a simple Pong-like game written in Hollywood.

At this point I was presented a code that did run as is in Hollywood, but every movement left a trail on the screen.

Me:
The ball and paddles are not erased before redrawing.

Deepseek
You're absolutely correct! In the Hollywood programming language, the screen is not automatically cleared between frames, so the ball and paddles will leave trails if not explicitly erased. To fix this, we need to clear the screen at the beginning of each frame by redrawing the background.


It did implement drawing a black box in the start of the loop to clear the screen, but this was not working since it forgot to fill the box. 

Me:
The black box is not filled, so it will still not erase anything

Deepseek:
You're absolutely right again! In Hollywood, the Box() function by default only draws the outline of a rectangle unless you explicitly specify that it should be filled. To fill the box and properly clear the screen, we need to use the {Fill = True} parameter in the Box() function.

Which of course did not work as the AI intended

Me:
The box command does support the fill argument

Deepseek:
You're absolutely correct again! I made a mistake in my earlier response. The Box() function in Hollywood does not support a {Fill = True} argument. Instead, to fill a rectangle, you need to use the FillBox() function. My apologies for the confusion!

This time it messed up by inventing a command that doesn't exist.

Me:
Fillbox is not at valid command in Hollywood

Deepseek:
You're absolutely correct again, and I appreciate your patience! I made another mistake in my response. Hollywood does not have a FillBox command. Instead, to draw filled rectangles, you should use the Box command with the Fill attribute set to True. Let me provide the correct and final version of the Pong game code in Hollywood, using the proper syntax.


Now it forgets what I previously told it...

Me:
No, that is what you tried the first time. I already told you Box does not support the fill argument. You must find another way to do this

Deepseek:
You're absolutely right, and I appreciate your patience as I wor
k through this. I now realize that Hollywood's Box command does not support a Fill argument, and there is no FillBox command. To achieve the desired effect of filling rectangles, we need to use a different approach. In Hollywood, we can use the SetFillStyle() function to set the fill style for shapes, and then use Box() to draw filled rectangles.

Now it getting in the right direction, coming up with setfillstyle without me telling it. But now it makes the mistake of removing the colour argument in the box command and tries to set the colour with the setfillstyle command

Me:
Setfillstyle does not the the colour argument, that have to be set in the box command

Deepseek:
Thank you for your patience and for pointing out the correct usage! You're absolutely right—SetFillStyle() does not take a color argument in Hollywood. Instead, the color is specified directly in the Box() command when using the {Fill = True} argument. I made a mistake earlier, and I appreciate your guidance.

Now it insists again to use the Fill argument in the Box command, so I had to remind it about that.

Me:
Again, I already told you that box does not take the fill argument, for that you was almost there with setfillstyle

Deepseek:
You're absolutely correct, and I deeply appreciate your patience as I work through this. I now realize that I misunderstood the Hollywood API earlier. Let me carefully revisit the documentation and provide the correct and final version of the Pong game code in Hollywood, using the proper approach with SetFillStyle() and Box().

Now it does look better, but for some reason it forgot something else..

Me:
Did you forget to draw the right paddle?

Deepseek:
You're absolutely right—I accidentally omitted the right paddle in the previous code. Thank you for catching that! Let me fix the issue and provide the complete and corrected version of the Pong game code in Hollywood, including both paddles.

Here is the code it provided this time:

Code: Select all

; Pong Game in Hollywood

; Set up the screen
@DISPLAY {Width = 800, Height = 600, Title = "Pong"}

; Define colors
WHITE = RGB(255, 255, 255)
BLACK = RGB(0, 0, 0)

; Paddle dimensions
PADDLE_WIDTH = 10
PADDLE_HEIGHT = 100

; Ball dimensions
BALL_SIZE = 20

; Initial positions
paddle1_x = 50
paddle1_y = 250
paddle2_x = 750
paddle2_y = 250
ball_x = 400
ball_y = 300

; Ball speed
ball_speed_x = 5
ball_speed_y = 5

; Game loop
Repeat
    ; Clear the screen by filling it with a black rectangle
    SetFillStyle(#FILLCOLOR)
    Box(0, 0, 800, 600, BLACK)

    ; Draw left paddle
    SetFillStyle(#FILLCOLOR)
    Box(paddle1_x, paddle1_y, PADDLE_WIDTH, PADDLE_HEIGHT, WHITE)

    ; Draw right paddle
    SetFillStyle(#FILLCOLOR)
    Box(paddle2_x, paddle2_y, PADDLE_WIDTH, PADDLE_HEIGHT, WHITE)

    ; Draw ball
    SetFillStyle(#FILLCOLOR)
    Box(ball_x, ball_y, BALL_SIZE, BALL_SIZE, WHITE)

    ; Move ball
    ball_x = ball_x + ball_speed_x
    ball_y = ball_y + ball_speed_y

    ; Ball collision with top and bottom walls
    If ball_y <= 0 Or ball_y + BALL_SIZE >= 600
        ball_speed_y = -ball_speed_y
    EndIf

    ; Ball collision with paddles
    If (ball_x <= paddle1_x + PADDLE_WIDTH And ball_y + BALL_SIZE >= paddle1_y And ball_y <= paddle1_y + PADDLE_HEIGHT) Or
       (ball_x + BALL_SIZE >= paddle2_x And ball_y + BALL_SIZE >= paddle2_y And ball_y <= paddle2_y + PADDLE_HEIGHT)
        ball_speed_x = -ball_speed_x
    EndIf

    ; Ball out of bounds (left or right)
    If ball_x <= 0 Or ball_x + BALL_SIZE >= 800
        ball_x = 400
        ball_y = 300
    EndIf

    ; Move paddles with arrow keys and W/S keys
    If IsKeyDown("Up") And paddle2_y > 0
        paddle2_y = paddle2_y - 5
    ElseIf IsKeyDown("Down") And paddle2_y + PADDLE_HEIGHT < 600
        paddle2_y = paddle2_y + 5
    EndIf

    If IsKeyDown("w") And paddle1_y > 0
        paddle1_y = paddle1_y - 5
    ElseIf IsKeyDown("s") And paddle1_y + PADDLE_HEIGHT < 600
        paddle1_y = paddle1_y + 5
    EndIf

    ; Update the display
    VWait

    ; Exit on ESC key
    If IsKeyDown("Esc")
        End
    EndIf
Forever
User avatar
airsoftsoftwair
Posts: 5668
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Pong game mede with Deepseek AI

Post by airsoftsoftwair »

Interesting story, thanks for sharing! Let's see how far those AIs get with Hollywood in a few years :)
Post Reply