# Sometimes the ball doesn't bounce off the paddle in pong game
# https://stackoverflow.com/questions/62864205/sometimes-the-ball-doesnt-bounce-off-the-paddle-in-pong-game

import pygame

pygame.init()
width, height = 400, 600
window = pygame.display.set_mode((width, height))
clock = pygame.time.Clock()

start_pos = (180, 160)
pos_list = []
step = 20
pos_list.append((start_pos[0]-step*2, start_pos[1]-step*2))
pos_list.append((start_pos[0]-step, start_pos[1]-step))
for i in range(12):
    x = start_pos[0] + (0 if i % 2 == 0 else step)
    y = start_pos[1] + i * step
    pos_list.append((x, y))
for i in range(3):
    lx, ly = pos_list[-1]
    pos_list.append((lx-step, ly+step))

current_i = 0
run = True
while run:
    clock.tick(5)
    for event in pygame.event.get():
        if event.type == pygame.QUIT: run = False


    window.fill((255, 255, 255))

    for pos in pos_list:
        pygame.draw.circle(window, (196, 196, 196), pos, 40, 1)

    pygame.draw.rect(window, (0, 0, 0), (200, 200, 40, 160), 3)

    pygame.draw.circle(window, (0, 0, 0), pos_list[current_i], 40, 3)
    if current_i > 0:
        pygame.draw.lines(window, (0, 196, 0), False, pos_list[:min(3, current_i+1)], 3)
    if current_i > 2:
        pygame.draw.lines(window, (228, 0, 0), False, pos_list[2:min(14, current_i+1)], 3)
    if current_i > 13:
        pygame.draw.lines(window, (0, 196, 0), False, pos_list[13:current_i+1], 3)
    current_i += 1
    if current_i >= len(pos_list):
        current_i = 0

    pygame.display.flip()
011cc378d4f147be622910ec025f9e6ec3ca8841
<mask token>

<mask token>
pygame.init()
<mask token>
pos_list.append((start_pos[0] - step * 2, start_pos[1] - step * 2))
pos_list.append((start_pos[0] - step, start_pos[1] - step))
for i in range(12):
    x = start_pos[0] + (0 if i % 2 == 0 else step)
    y = start_pos[1] + i * step
    pos_list.append((x, y))
for i in range(3):
    lx, ly = pos_list[-1]
    pos_list.append((lx - step, ly + step))
<mask token>
while run:
    clock.tick(5)
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            run = False
    window.fill((255, 255, 255))
    for pos in pos_list:
        pygame.draw.circle(window, (196, 196, 196), pos, 40, 1)
    pygame.draw.rect(window, (0, 0, 0), (200, 200, 40, 160), 3)
    pygame.draw.circle(window, (0, 0, 0), pos_list[current_i], 40, 3)
    if current_i > 0:
        pygame.draw.lines(window, (0, 196, 0), False, pos_list[:min(3, 
            current_i + 1)], 3)
    if current_i > 2:
        pygame.draw.lines(window, (228, 0, 0), False, pos_list[2:min(14, 
            current_i + 1)], 3)
    if current_i > 13:
        pygame.draw.lines(window, (0, 196, 0), False, pos_list[13:current_i +
            1], 3)
    current_i += 1
    if current_i >= len(pos_list):
        current_i = 0
    pygame.display.flip()

<mask token>
pygame.init()
width, height = 400, 600
window = pygame.display.set_mode((width, height))
clock = pygame.time.Clock()
start_pos = 180, 160
pos_list = []
step = 20
pos_list.append((start_pos[0] - step * 2, start_pos[1] - step * 2))
pos_list.append((start_pos[0] - step, start_pos[1] - step))
for i in range(12):
    x = start_pos[0] + (0 if i % 2 == 0 else step)
    y = start_pos[1] + i * step
    pos_list.append((x, y))
for i in range(3):
    lx, ly = pos_list[-1]
    pos_list.append((lx - step, ly + step))
current_i = 0
run = True
while run:
    clock.tick(5)
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            run = False
    window.fill((255, 255, 255))
    for pos in pos_list:
        pygame.draw.circle(window, (196, 196, 196), pos, 40, 1)
    pygame.draw.rect(window, (0, 0, 0), (200, 200, 40, 160), 3)
    pygame.draw.circle(window, (0, 0, 0), pos_list[current_i], 40, 3)
    if current_i > 0:
        pygame.draw.lines(window, (0, 196, 0), False, pos_list[:min(3, 
            current_i + 1)], 3)
    if current_i > 2:
        pygame.draw.lines(window, (228, 0, 0), False, pos_list[2:min(14, 
            current_i + 1)], 3)
    if current_i > 13:
        pygame.draw.lines(window, (0, 196, 0), False, pos_list[13:current_i +
            1], 3)
    current_i += 1
    if current_i >= len(pos_list):
        current_i = 0
    pygame.display.flip()

import pygame
pygame.init()
width, height = 400, 600
window = pygame.display.set_mode((width, height))
clock = pygame.time.Clock()
start_pos = 180, 160
pos_list = []
step = 20
pos_list.append((start_pos[0] - step * 2, start_pos[1] - step * 2))
pos_list.append((start_pos[0] - step, start_pos[1] - step))
for i in range(12):
    x = start_pos[0] + (0 if i % 2 == 0 else step)
    y = start_pos[1] + i * step
    pos_list.append((x, y))
for i in range(3):
    lx, ly = pos_list[-1]
    pos_list.append((lx - step, ly + step))
current_i = 0
run = True
while run:
    clock.tick(5)
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            run = False
    window.fill((255, 255, 255))
    for pos in pos_list:
        pygame.draw.circle(window, (196, 196, 196), pos, 40, 1)
    pygame.draw.rect(window, (0, 0, 0), (200, 200, 40, 160), 3)
    pygame.draw.circle(window, (0, 0, 0), pos_list[current_i], 40, 3)
    if current_i > 0:
        pygame.draw.lines(window, (0, 196, 0), False, pos_list[:min(3, 
            current_i + 1)], 3)
    if current_i > 2:
        pygame.draw.lines(window, (228, 0, 0), False, pos_list[2:min(14, 
            current_i + 1)], 3)
    if current_i > 13:
        pygame.draw.lines(window, (0, 196, 0), False, pos_list[13:current_i +
            1], 3)
    current_i += 1
    if current_i >= len(pos_list):
        current_i = 0
    pygame.display.flip()

# Sometimes the ball doesn't bounce off the paddle in pong game
# https://stackoverflow.com/questions/62864205/sometimes-the-ball-doesnt-bounce-off-the-paddle-in-pong-game

import pygame

pygame.init()
width, height = 400, 600
window = pygame.display.set_mode((width, height))
clock = pygame.time.Clock()

start_pos = (180, 160)
pos_list = []
step = 20
pos_list.append((start_pos[0]-step*2, start_pos[1]-step*2))
pos_list.append((start_pos[0]-step, start_pos[1]-step))
for i in range(12):
    x = start_pos[0] + (0 if i % 2 == 0 else step)
    y = start_pos[1] + i * step
    pos_list.append((x, y))
for i in range(3):
    lx, ly = pos_list[-1]
    pos_list.append((lx-step, ly+step))

current_i = 0
run = True
while run:
    clock.tick(5)
    for event in pygame.event.get():
        if event.type == pygame.QUIT: run = False


    window.fill((255, 255, 255))

    for pos in pos_list:
        pygame.draw.circle(window, (196, 196, 196), pos, 40, 1)

    pygame.draw.rect(window, (0, 0, 0), (200, 200, 40, 160), 3)

    pygame.draw.circle(window, (0, 0, 0), pos_list[current_i], 40, 3)
    if current_i > 0:
        pygame.draw.lines(window, (0, 196, 0), False, pos_list[:min(3, current_i+1)], 3)
    if current_i > 2:
        pygame.draw.lines(window, (228, 0, 0), False, pos_list[2:min(14, current_i+1)], 3)
    if current_i > 13:
        pygame.draw.lines(window, (0, 196, 0), False, pos_list[13:current_i+1], 3)
    current_i += 1
    if current_i >= len(pos_list):
        current_i = 0

    pygame.display.flip()