import os
import random
from util import getTurtleAndScreen
# Random 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
colors = ["red","yellow",(0,255,0),"#FFFFFF",'#0000BB',(127,127,127),"turquoise","#E8205A"]
filename = os.path.basename(__file__)[0:-3]
turtle, screen = getTurtleAndScreen("Circles",width,height,filename,moveWorld=True)
screen.bgcolor("gold")
percent = random.uniform(.5, .9)
for row in range (0,numRows):
for col in range(0,numCols):
newCellSize = percent*cellSize
x = col * cellSize + cellSize/2
y= row * cellSize + (1-percent)*cellSize/2
turtle.penup()
turtle.goto(x,y)
colorNumber = random.randint(0,7)
turtle.color(colors[colorNumber])
turtle.pendown()
turtle.begin_fill()
turtle.setheading(0)
turtle.circle(newCellSize/2)
turtle.end_fill()
screen.mainloop()