Script to generate process with cubic composition

Hello!

I was wondering if there were any scripts that would create the same results of Kafka Castle (https://www.archdaily.com/121483/ad-classics-kafka-castle-ricardo-bofill) or Habitat 67 (https://www.archdaily.com/404803/ad-classics-habitat-67-moshe-safdie) wherein cube or cube-like masses are stacked on a seemingly random order?

I’d like to reverse-engineer how you were able to accomplish the script, if possible. If there are also videos that have done similar results, please send me a link too! Thanks! I’ve done Nick Senske’s randomness videos but our goals are still different.

Well … Kafka’s meaning in that all time classic novel is totally different than that nightmare (pig ugly as well) : the castle in the story is indifferent (and the always absent ruler as well - even Klamm proves utterly inaccessible). K (the hero) would be disappointed I must say.

Other than that … some sort of recursion on boxes could solve(?) that … up to a point since we are talking about habitable(?) modular spaces and the rules of composition/connection are far more complex than “put this on that provited that there’s space available”. It’s a classic case where the manual composition could yield way faster (and “better”) results having in mind the building law valid in the region of interest (not to mention seismic activity).

Anyway … do you speak C#? (But why waste time for that thing? that’s the 1Z question).