PyGGB (test): #truchet patchwork

Image
# truchet patchwork 10/08/2023 from random import* import time # background: A=Point(-100,-100, is_visible=False) B=Point(100,-100, is_visible=False) background=Polygon(A,B,4,opacity=1,color=[1,1,1]) #vert rgb(70, 144, 118) #rosef rgb(212, 98, 157) #rosec rgb(237, 160, 203) #bleu rgb(94, 111, 166) #orange rgb(171, 61, 40) #jaune rgb(207, 154, 68) #vert 2 rgb(211, 194, 150) lcol=[[70/255, 144/255, 118/255],[212/255, 98/255, 157/255],[237/255, 160/255, 203/255],[94/255, 111/255, 166/255],[171/255, 61/255, 40/255],[207/255, 154/255, 68/255],[211/255, 194/255, 150/255],[0,0,0],[0,0,0]] def motif(n,m): for i in range(n): for j in range(m): r=random() col=choice(lcol) if r<0.25 : l=[Point(i,j,is_visible=False),Point(i+1,j,is_visible=False),Point(i+1,j+1,is_visible=False)] s=Polygon(l,color=col,opacity=1,line_thickness=0) col=choice(lcol) l=[Point(-i,j,is_visible=False),Point(-(i+1),j,is_visible=False),Point(-(i+1),j+1,is_visible=False)] s=Polygon(l,color=col,opacity=1,line_thickness=0) col=choice(lcol) l=[Point(i,-j,is_visible=False),Point(i+1,-j,is_visible=False),Point(i+1,-(j+1),is_visible=False)] s=Polygon(l,color=col,opacity=1,line_thickness=0) col=choice(lcol) l=[Point(-i,-j,is_visible=False),Point(-(i+1),-j,is_visible=False),Point(-(i+1),-(j+1),is_visible=False)] s=Polygon(l,color=col,opacity=1,line_thickness=0) elif r<0.5 : l=[Point(i,j,is_visible=False),Point(i,j+1,is_visible=False),Point(i+1,j,is_visible=False)] s=Polygon(l,color=col,opacity=1,line_thickness=0) col=choice(lcol) l=[Point(-i,j,is_visible=False),Point(-i,j+1,is_visible=False),Point(-(i+1),j,is_visible=False)] s=Polygon(l,color=col,opacity=1,line_thickness=0) col=choice(lcol) l=[Point(i,-j,is_visible=False),Point(i,-(j+1),is_visible=False),Point(i+1,-j,is_visible=False)] s=Polygon(l,color=col,opacity=1,line_thickness=0) col=choice(lcol) l=[Point(-i,-j,is_visible=False),Point(-i,-(j+1),is_visible=False),Point(-(i+1),-j,is_visible=False)] s=Polygon(l,color=col,opacity=1,line_thickness=0) elif r<0.75 : l=[Point(i+1,j,is_visible=False),Point(i+1,j+1,is_visible=False),Point(i,j+1,is_visible=False)] s=Polygon(l,color=col,opacity=1,line_thickness=0) col=choice(lcol) l=[Point(-(i+1),j,is_visible=False),Point(-(i+1),j+1,is_visible=False),Point(-i,j+1,is_visible=False)] s=Polygon(l,color=col,opacity=1,line_thickness=0) col=choice(lcol) l=[Point(i+1,-j,is_visible=False),Point(i+1,-(j+1),is_visible=False),Point(i,-(j+1),is_visible=False)] s=Polygon(l,color=col,opacity=1,line_thickness=0) col=choice(lcol) l=[Point(-(i+1),-j,is_visible=False),Point(-(i+1),-(j+1),is_visible=False),Point(-i,-(j+1),is_visible=False)] s=Polygon(l,color=col,opacity=1,line_thickness=0) else: l=[Point(i,j,is_visible=False),Point(i,j+1,is_visible=False),Point(i+1,j+1,is_visible=False)] s=Polygon(l,color=col,opacity=1,line_thickness=0) col=choice(lcol) l=[Point(-i,j,is_visible=False),Point(-i,j+1,is_visible=False),Point(-(i+1),(j+1),is_visible=False)] s=Polygon(l,color=col,opacity=1,line_thickness=0) col=choice(lcol) l=[Point(i,-j,is_visible=False),Point(i,-(j+1),is_visible=False),Point(i+1,-(j+1),is_visible=False)] s=Polygon(l,color=col,opacity=1,line_thickness=0) col=choice(lcol) l=[Point(-i,-j,is_visible=False),Point(-i,-(j+1),is_visible=False),Point(-(i+1),-(j+1),is_visible=False)] s=Polygon(l,color=col,opacity=1,line_thickness=0) time.sleep(0.001) motif(10,7)
Image