Code
red = "#e63946"
white = "#f1faee"
l_blue = "#a8dadc"
blue = "#457b9d"
d_blue = "#1d3557"
def board(size):
c_size=22
c = circle(r=c_size,stroke="#11111122",stroke_width=3,fill="#444")
c1 = c | translate(x=150-(c_size//2),y=150-(c_size//2))
c2 = c | translate(x=-150+(c_size//2),y=-150+(c_size//2))
c3 = c | translate(x=150-(c_size//2),y=-150+(c_size//2))
c4 = c | translate(x=-150+(c_size//2),y=150-(c_size//2))
r = rectangle(h=size,w=size,stroke="none",fill=l_blue)
return combine([r,c1,c2,c3,c4])
def placing():
width = 160
r = rectangle(w=width,h=30,stroke=blue,stroke_width=3)
c = circle(r=15,stroke=blue,stroke_width=3,fill=l_blue)
c1 = c | translate(y=0,x=-(width//2))
c2 = c | translate(y=0,x=(width//2))
c = circle(r=10,stroke="none",fill=blue)
c3 = c | translate(y=0,x=-(width//2))
c4 = c | translate(y=0,x=(width//2))
return combine([r,c1,c2,c3,c4])
def placed():
p = placing()
move = 110
p1 = p | translate(x=0,y=move)
p2 = p | translate(x=0,y=-move)
p3 = p | rotate(90) | translate(x=-move,y=0)
p4 = p | rotate(90) | translate(x=move,y=0)
return combine([p1,p2,p3,p4])
def coin(color):
c = circle(r=14,stroke="#00009920",fill=color)
return c
def center():
c = circle(r=72,stroke=blue,stroke_width=3,fill=l_blue)
queen = coin(red)
light = coin(white)
dark = coin(d_blue)
light1 = light | translate(x=24.25,y=14)
light2 = light | translate(x=48.5,y=28)
dark1 = dark | translate(x=-24.25,y=-14)
light3 = light | translate(x=-48.5,y=-28)
light4 = light | translate(x=-24.25,y=14)
light5 = light | translate(x=-48.5,y=28)
dark2 = dark | translate(x=24.25,y=-14)
light6 = light | translate(x=48.5,y=-28)
dark3 = dark | translate(x=-49.5,y=0)
dark4 = dark | translate(x=49.5,y=0)
dark5 = dark | translate(x=0,y=28)
light7 = light | translate(x=0,y=-28)
light8 = light | translate(x=0,y=-56)
light9 = light | translate(x=0,y=56)
dark6 = dark | translate(x=-23.5,y=42.5)
dark7 = dark | translate(x=23.5,y=42.5)
dark8 = dark | translate(x=-23.5,y=-42.5)
dark9 = dark | translate(x=23.5,y=-42.5)
light = combine([light1,light2,light3,light4,light5,light6,light7,light8,light9])
dark = combine([dark1,dark2,dark3,dark4,dark5,dark6,dark7,dark8,dark9])
coinset = combine([queen,light,dark])
return combine([c,coinset])
def striker():
c = circle(r=18,stroke="#1d355790",stroke_width=3,fill="#fff")
e = ellipse(w=25,h=10,stroke_width=2,stroke=d_blue)
e1 = e | rotate(60)
e2 = e | rotate(-60)
c1 = circle(r=2,stroke="none",fill=d_blue)
return combine([c,e,e1,e2,c1])
b = board(320)
p = placed()
c = center()
s = striker() | translate(x=0,y=-110)
carrom = combine([b,p,c,s])
show(carrom)