#Import the pygame library
import pygame

#Initialize the game
pygame.init()

#Set the window size
window_width = 800
window_height = 600

#Create the window
window = pygame.display.set_mode((window_width, window_height))

#Set the window title
pygame.display.set_caption('Pong')

#Set the clock
clock = pygame.time.Clock()

#Define colors
white = (255, 255, 255)
black = (0, 0, 0)

#Define game variables
ball_pos_x = window_width/2
ball_pos_y = window_height/2
ball_radius = 10
ball_vel_x = 3
ball_vel_y = 3

#Define paddles
paddle_width = 10
paddle_height = 80
paddle_1_pos_x = 20
paddle_1_pos_y = window_height/2 - paddle_height/2
paddle_2_pos_x = window_width - 20 - paddle_width
paddle_2_pos_y = window_height/2 - paddle_height/2

#Game loop
while True:
    #Handle events
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            pygame.quit()
            exit()

#Update positions
ball_pos_x += ball_vel_x
ball_pos_y += ball_vel_y

 #Check for collisions
if ball_pos_x - ball_radius <= 0:
        ball_vel_x *= -1
elif ball_pos_x + ball_radius >= window_width:
        ball_vel_x *= -1
elif ball_pos_y - ball_radius <= 0:
        ball_vel_y *= -1
elif ball_pos_y + ball_radius >= window_height:
        ball_vel_y *= -1

#Draw the window
window.fill(black)
pygame.draw.circle(window, white, (int(ball_pos_x), int(ball_pos_y)), ball_radius)
pygame.draw.rect(window, white, (paddle_1_pos_x, paddle_1_pos_y, paddle_width, paddle_height))
pygame.draw.rect(window, white, (paddle_2_pos_x, paddle_2_pos_y, paddle_width, paddle_height))
pygame.display.update()

#Delay to get 60 fps
clock.tick(60)
spam fails_task lang_mismatch pii not_appropriate hate_speech sexual_content quality toxicity humor helpfulness creativity violence