import random
import os
from drawMethods import drawConcentricCircles
from palettes import randomPalette
from util import getTurtleAndScreen
# Filled Circles
# Drawing a grid of partial concentric circles using a
# new method drawConcentricCircles that we created in drawMethods.
# In this version we ensure that Circles next to each other are different
# colors.
# CAC, 3/15/2023
def Draw():
title = "Partial Concentric Circles w/Different Colored Neighbors"
width = 800
height = 600
cellSize = 100
numCols = width // cellSize
numRows = height // cellSize
number = random.randint(2, 8)
title=title+" "+str(number)
filename = os.path.basename(__file__)[0:-3]
turtle, screen = getTurtleAndScreen(title,width,height,filename,moveWorld=True)
colors = randomPalette()
bg = random.choice(colors)
screen.bgcolor(bg)
if(random.randint(0,1)==1):
colors.remove(bg)
lineWidth = 2*random.randint(1,10)
turtle.pensize(lineWidth)
for row in range (0,numRows):
for col in range(0,numCols):
radius = cellSize//2
x = col*cellSize + radius
y = row*cellSize + radius
color=random.choice(colors)
turtle.color(color)
extent = random.randint(210,300)
start = random.randint(0,359)
drawConcentricCircles(turtle, x, y, radius, number,
colors, extent=extent,
start=start,
forceDifferentColors=True)
turtle.penup()
turtle.goto(0,0)
screen.mainloop()
# ----------------------------------------------------------------
if __name__ == '__main__':
Draw()