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()

[((26, 39), 'pygame.init', 'pygame.init', ([], {}), '()\n', (37, 39), False, 'import pygame\n'), ((48, 67), 'pygame.time.Clock', 'pygame.time.Clock', ([], {}), '()\n', (65, 67), False, 'import pygame\n'), ((78, 113), 'pygame.display.set_mode', 'pygame.display.set_mode', (['[500, 500]'], {}), '([500, 500])\n', (101, 113), False, 'import pygame\n'), ((823, 836), 'pygame.quit', 'pygame.quit', ([], {}), '()\n', (834, 836), False, 'import pygame\n'), ((231, 249), 'pygame.event.get', 'pygame.event.get', ([], {}), '()\n', (247, 249), False, 'import pygame\n'), ((662, 713), 'pygame.draw.circle', 'pygame.draw.circle', (['screen', '[0, 0, 0]', '[x1, y1]', '(10)'], {}), '(screen, [0, 0, 0], [x1, y1], 10)\n', (680, 713), False, 'import pygame\n'), ((715, 768), 'pygame.draw.rect', 'pygame.draw.rect', (['screen', '[0, 0, 0]', '[x2, y2, 30, 30]'], {}), '(screen, [0, 0, 0], [x2, y2, 30, 30])\n', (731, 768), False, 'import pygame\n'), ((801, 822), 'pygame.display.flip', 'pygame.display.flip', ([], {}), '()\n', (820, 822), False, 'import pygame\n'), ((301, 314), 'pygame.quit', 'pygame.quit', ([], {}), '()\n', (312, 314), False, 'import pygame\n'), ((327, 337), 'sys.exit', 'sys.exit', ([], {}), '()\n', (335, 337), False, 'import sys\n')]