import os
import random
from drawMethods import drawCircle
from palettes import randomNamedPalette
from util import getTurtleAndScreen
# Random Concentric Colored Circles
# CAC, 2024
# For this one I determine the size of the screen by first realizing I want
# to break it up into an 8x8 grid of a given size square cell.
cellSize=100
numCols=16
numRows=8
width=cellSize*numCols
height = cellSize*numRows
name,palette = randomNamedPalette()
filename = os.path.basename(__file__)[0:-3]
turtle, screen = getTurtleAndScreen("Concentric Circles ("+name+")",width,height,filename,moveWorld=True)
bgcolor = random.choice(palette)
screen.bgcolor(bgcolor)
if random.randint(0,1):
palette.remove(bgcolor)
for row in range (0,numRows):
for col in range(0,numCols):
x = col * cellSize + cellSize / 2
y = row * cellSize + cellSize / 2
for i in range(0,5):
percent = .9-i*.2
radius = percent*cellSize/2
turtle.color(random.choice(palette))
drawCircle(turtle, x, y, radius)
screen.mainloop()