import bricklayer as bl from brickwright import TestContext def create_build(): b = bl.LegoBuild() C = bl.Color def add(pid, color, x,y,z, name=None, rot=bl.Rotation.DEG_0): return b.add(bl.Element(pid,color),(x,y,z),rotation=rot,name=name) # Broad low plinth keeps the overhanging offering and head well inside its footprint. add('91405',C.DARK_BLUISH_GRAY,0,0,0,'plinth') # A continuous, legless silhouette, narrow at the hem, broad at the shoulders. # Each tier overlaps the previous one by several studs. tiers = [(6,9,4,4,1/3,3), (5,8,6,4,10/3,3), (5,7,6,4,19/3,3), (4,6,8,4,28/3,8/3), (4,5,8,6,37/3,3), (4,5,8,6,46/3,3), (5,5,6,6,56/3,2)] for i,(x,y,w,d,z,h) in enumerate(tiers): core = bl.fill_box((0,0,0),(w,d,h),C.BLACK) b.add(core,(x,y,z),name=f'body_tier_{i}') # Roof slopes round the crown and shoulder edges. for x in (5,7,9): add('3039',C.BLACK,x,5,62/3,rot=bl.Rotation.DEG_0) add('3039',C.BLACK,x,9,62/3,rot=bl.Rotation.DEG_180) add('3022',C.BLACK,7,7,62/3,'crown_bridge') for x in (5,9): add('15068',C.BLACK,x,7,62/3) # Side roots and long, narrow forward-reaching arms, one stud thick. add('3032',C.BLACK,5,6,12,'shoulder_bridge') for side,x in [('right',1),('left',14)]: rootx = 1 if side=='right' else 11 add('3020',C.BLACK,rootx,7,12,f'{side}_shoulder') add('3024',C.BLACK,x,7,37/3) add('3666',C.BLACK,x,2,38/3,f'{side}_arm',rot=bl.Rotation.DEG_90) add('3666',C.BLACK,x,2,39/3,rot=bl.Rotation.DEG_90) add('3020',C.BLACK,1 if side=='right' else 11,1,40/3,f'{side}_palm') # Joined cupped hands beneath a substantial mound of gold. add('3832',C.BLACK,3,0,41/3,'offering_support') for x in (4,6,8,10): add('3022',C.PEARL_GOLD,x,0,14) for i,(x,y,z) in enumerate([(4,1,43/3),(5,2,43/3),(6,1,43/3),(7,2,43/3), (8,1,43/3),(9,2,43/3),(10,1,43/3),(11,2,43/3), (5,1,43/3),(7,1,43/3),(9,1,43/3), (6,2,43/3),(8,2,43/3),(10,2,43/3)]): add('4073',C.PEARL_GOLD,x,y-1,z,f'held_nugget_{i}') for i,(x,y) in enumerate([(4,1),(5,2),(6,1),(7,2),(8,1),(9,2),(10,1),(11,2)]): extra = 2 if x in (6,7,8,9) else 0 for j in range(extra): add('4073',C.PEARL_GOLD,x,y-1,(44+j)/3) add('54200', C.PEARL_GOLD,x,y-1,(44+extra)/3,f'held_facet_{i}',rot=bl.Rotation(i%4)) # Ground spill: irregular little piles rather than loose, unattached pieces. for i,(x,y,n) in enumerate([(5,4,2),(7,3,3),(9,4,2),(11,5,1),(4,6,2), (8,6,3),(10,7,1),(6,6,1),(3,3,1),(12,3,2), (6,1,1),(8,1,2),(10,2,1),(12,7,1)]): for j in range(n): add('4073',C.PEARL_GOLD,x,y,(1+j)/3,f'spill_{i}_{j}') add('54200',C.PEARL_GOLD,x,y,(1+n)/3,rot=bl.Rotation(i%4)) # Mask is a sideways, stud-connected mosaic with a rounded oval outline. face = bl.LegoBuild() face.add(bl.Element('3034',C.WHITE),(2,0,0),rotation=bl.Rotation.DEG_90) face.add(bl.Element('3023',C.WHITE),(2,8,0)) face.add(bl.Element('3022',C.WHITE),(2,7,-1/3)) rows = [(2,2),(1,4),(0,6),(0,6),(0,6),(0,6),(0,6),(1,4),(2,2)] ids = {2:'3023',4:'3710',6:'3666'} for y,(x,w) in enumerate(rows): face.add(bl.Element(ids[w],C.WHITE),(x,y,1/3)) for u in range(x,x+w): color=C.WHITE if (u,y) in [(1,5),(4,5),(2,1),(3,1)]: color=C.BLACK if (u,y) in [(1,6),(4,6),(1,4),(4,4),(1,3),(4,3)]: color=C.DARK_PURPLE pid = '98138' if (u,y) in [(1,5),(4,5)] else '3070b' face.add(bl.Element(pid,color),(u,y,2/3)) # The mount replaces one front-face brick volume with an outboard SNOT brick. mount=add('11211',C.BLACK,7,4,52/3,'mask_mount') # Mount is connected back into the chest with the cap plate above it. add('3035',C.BLACK,4,4,55/3,'mask_anchor_cap') add('3034',C.BLACK,4,8,55/3) add('3460',C.BLACK,4,10,55/3) source=face.find_connector('antistud',toward=(2.5,4.5,0)) b.connect(face,source,to=mount.find_connector('stud',facing=bl.Direction.FRONT,toward=bl.Direction.RIGHT), target_rotation=bl.rotation_about(bl.Vec3(1,0,0),90),name='oval_mask') return b def run_tests(): b=create_build() tests=TestContext(b) tests.check_no_floating() tests.check_no_collisions() tests.check_connected(expected_components=1) tests.check('at most 400 parts',b.brick_count <=400,str(b.brick_count)) tests.check('tall spirit',b.height>20, str(b.height)) tests.check('two offering arms',all(n in b.names for n in ['right_arm','left_arm','right_palm','left_palm'])) tests.check('white mask and purple markings',sum(n for e,n in b.list_elements().items() if e.color==bl.Color.DARK_PURPLE)>=6) tests.check('gold in hands and on ground',sum(n for e,n in b.list_elements().items() if e.color==bl.Color.PEARL_GOLD)>40) tests.check('broad stability footprint',b.named('plinth').width>=16 and b.named('plinth').depth>=16) tests.check('forward leaning silhouette',b.named('body_tier_6').center.y < b.named('body_tier_0').center.y-2) # Conservative geometric mass proxy: the projected centroid stays well inside the plinth. weighted=[] for p in b.flattened_placements: lo,hi=p.bounding_box weight=(hi.x-lo.x)*(hi.y-lo.y)*(hi.z-lo.z) weighted.append((weight,p.center)) total=sum(w for w,c in weighted) cx=sum(w*c.x for w,c in weighted)/total cy=sum(w*c.y for w,c in weighted)/total tests.check('center of mass proxy safely inside base',3