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, 0, 4, 13), 'pygame.init', 'pygame.init', ({}, {}), '()', False, 'import pygame\n'), ((5, 8, 5, 27), 'pygame.time.Clock', 'pygame.time.Clock', ({}, {}), '()', False, 'import pygame\n'), ((7, 9, 7, 44), 'pygame.display.set_mode', 'pygame.display.set_mode', ({(7, 33, 7, 43): '[500, 500]'}, {}), '([500, 500])', False, 'import pygame\n'), ((46, 0, 46, 13), 'pygame.quit', 'pygame.quit', ({}, {}), '()', False, 'import pygame\n'), ((16, 17, 16, 35), 'pygame.event.get', 'pygame.event.get', ({}, {}), '()', False, 'import pygame\n'), ((41, 4, 41, 52), 'pygame.draw.circle', 'pygame.draw.circle', ({(41, 23, 41, 29): 'screen', (41, 31, 41, 38): '[0, 0, 0]', (41, 40, 41, 47): '[x1, y1]', (41, 49, 41, 51): '(10)'}, {}), '(screen, [0, 0, 0], [x1, y1], 10)', False, 'import pygame\n'), ((42, 4, 42, 52), 'pygame.draw.rect', 'pygame.draw.rect', ({(42, 21, 42, 27): 'screen', (42, 29, 42, 36): '[0, 0, 0]', (42, 38, 42, 51): '[x2, y2, 30, 30]'}, {}), '(screen, [0, 0, 0], [x2, y2, 30, 30])', False, 'import pygame\n'), ((45, 4, 45, 25), 'pygame.display.flip', 'pygame.display.flip', ({}, {}), '()', False, 'import pygame\n'), ((18, 12, 18, 25), 'pygame.quit', 'pygame.quit', ({}, {}), '()', False, 'import pygame\n'), ((19, 12, 19, 22), 'sys.exit', 'sys.exit', ({}, {}), '()', False, 'import sys\n')]