﻿import pygame

screen_dimensions = (640, 480)
BLUE_PURPLE = (90,10,255)
YELLOW = (250,230,140)

screen = pygame.display.set_mode((screen_dimensions))

WIDTH = 100
SIZE = WIDTH
HEIGHT = WIDTH
CIRCLE_RADIUS = WIDTH / 12

def draw_side_1():
    startx, starty = 50, 50
    circlexy = (100,100)
    pygame.draw.rect(screen, BLUE_PURPLE, (startx, starty, SIZE, SIZE))
    pygame.draw.circle(screen, YELLOW, circlexy, 8)

def draw_side_2():
    startx, starty = 150, 50
    circle1xy = (175,125)
    circle2xy = (225,75)
    pygame.draw.rect(screen, BLUE_PURPLE, (startx, starty, SIZE, SIZE))
    pygame.draw.circle(screen, YELLOW, circle1xy, 8)
    pygame.draw.circle(screen, YELLOW, circle2xy, 8)

def build_xymap(rect):
    between = rect.width / 4
    xymap = {}
    for i in range(1,4):
        x = rect.x + between
        y = rect.y + ( between * i )
        xymap[i] = (x,y)
    xymap[4] = (rect.x + (between * 2), rect.y + (between * 2))
    for i in range(1,4):
        x = rect.x + (between * 3)
        y = rect.y + (between * i)
        xymap[i+4] = (x,y)
    return xymap

def draw_square(rect):
    pygame.draw.rect(screen, BLUE_PURPLE, rect)

def draw_circles(numap, xym):
    for key in numap:
        pygame.draw.circle(screen, YELLOW, (xym[key][0], xym[key][1]), CIRCLE_RADIUS)

def base(x,y):
    rect = pygame.Rect(x, y, WIDTH, HEIGHT)
    draw_square(rect)
    xymap = build_xymap(rect)
    return xymap

def side1(x, y):
    xymap = base(x,y)
    draw_circles([4], xymap)


def side2(x, y):
    xymap = base(x,y)
    draw_circles([3,5], xymap)

def side3(x, y):
    xymap = base(x,y)
    draw_circles([3,4,5], xymap)

def side4(x, y):
    xymap = base(x,y)
    draw_circles([1,3,5,7], xymap)

def side5(x, y):
    xymap = base(x,y)
    draw_circles([1,3,4,5,7], xymap)

def side6(x, y):
    xymap = base(x,y)
    draw_circles([1,2,3,5,6,7], xymap)


draw_side_1()
draw_side_2()

'''
side1(50,50)
side2(175,50)
side3(300,50)
side4(50,175)
side5(175,175)
side6(300,175)
'''
pygame.display.update()


while True:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            pygame.quit()

