Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
8 lines proc solution in Clear category for Fused Cubes by CDG.Axel
def fused_cubes(cubes, prod=__import__('itertools').product):
shifts, ci = [(1, 0, 0), (-1, 0, 0), (0, 1, 0), (0, -1, 0), (0, 0, 1), (0, 0, -1)], 0
cubes = [set(prod(range(x, x+l), range(y, y+l), range(z, z+l))) for x, y, z, l in cubes]
while ci < len(cubes):
for i in range(ci):
if cubes[i] & {(x+dx, y+dy, z+dz) for x, y, z in cubes[ci] for dx, dy, dz in shifts}:
cubes[ci: ci+1], _, ci = [], cubes[i].update(cubes[ci]), 0
ci += 1
return [len(cube) for cube in cubes]
Jan. 22, 2022
Comments: