import pygame
import sys

pygame.init()
clock = pygame.time.Clock()

screen = pygame.display.set_mode([500, 500])

gameOn = True
x1 = 0
y1 = 100
x2 = 100
y2 = 0
while gameOn == True:
    screen.fill([255,255,255])
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            pygame.quit()
            sys.exit()
    
    if x1 == 500:
        moveRight = False
    elif x1 == 0:
        moveRight = True
    
    if y2 == 500:
        moveDown = False
    elif y2 == 0:
        moveDown = True
        
    if moveRight:
        x1 = x1+1
    else:
        x1 = x1-1

    if moveDown:
        y2 = y2+1
    else:
        y2 = y2-1

    pygame.draw.circle(screen, [0,0,0], [x1,y1], 10)
    pygame.draw.rect(screen, [0,0,0], [x2,y2,30,30])
            
    clock.tick(100)
    pygame.display.flip()
pygame.quit()

[(4, 'pygame.init', 'pygame.init', ([], {}), False, 'import pygame\n'), (5, 'pygame.time.Clock', 'pygame.time.Clock', ([], {}), False, 'import pygame\n'), (7, 'pygame.display.set_mode', 'pygame.display.set_mode', (['[500, 500]'], {}), False, 'import pygame\n'), (46, 'pygame.quit', 'pygame.quit', ([], {}), False, 'import pygame\n'), (16, 'pygame.event.get', 'pygame.event.get', ([], {}), False, 'import pygame\n'), (41, 'pygame.draw.circle', 'pygame.draw.circle', (['screen', '[0, 0, 0]', '[x1, y1]', '(10)'], {}), False, 'import pygame\n'), (42, 'pygame.draw.rect', 'pygame.draw.rect', (['screen', '[0, 0, 0]', '[x2, y2, 30, 30]'], {}), False, 'import pygame\n'), (45, 'pygame.display.flip', 'pygame.display.flip', ([], {}), False, 'import pygame\n'), (18, 'pygame.quit', 'pygame.quit', ([], {}), False, 'import pygame\n'), (19, 'sys.exit', 'sys.exit', ([], {}), False, 'import sys\n')]