mikepound / cubes

This code calculates all the variations of 3D polycubes for any size (time permitting!)
MIT License
163 stars 43 forks source link

[Discussion] Traversal as opposed to grid representation #19

Open lucashutyler opened 1 year ago

lucashutyler commented 1 year ago

Explanation

Consider a list of directions instead of a representation of the polycubes inside a n-dimensional array. Start with 2D for simplicity. For 2D we will just go "north (n), south (s), east (e), west (w)."

Size Direction Sets Notes
1 no movement allowed
2 n e, w, s are rotations
3 (n: n)
(n: e)
we can only start from previous terms
4 (n,n: n)
(n,n: e)
(n,e: n)
(n,e: s)
(n,e+n or n,n: s,e)??
how to define the "T" tetromino splitting or backtracking?

Using a logic like this it feels like we could develop a set of rules for traversal. We might be able to determine that certain "turns" would simply be unallowed (overlap previous blocks, produce rotations, etc).

To elevate this to 3D, we would only have to add up and down.

Size Direction Sets Notes
1 no movement allowed
2 n e, w, s, u, d are all "rotations"
3 (n: n)
(n: e)
-
4 (n,n: n)
(n,n: e)
(n,e: n)
(n,e: s)
(n,e: u)
(n,e+n or n,n: s,e)
(n,e+u or n,e: w,u)
(n,w: u or n,u: e)??
the last one is a mirror of (n,e: u) and not derived from the previous set

We'd have to go a few more terms to try to find more "rules" when adding on to previous sets.

While this could easily be hashed, ideally we would not have to hash anything and just have a set of rules that are followed until completion, giving us our number of shapes possible.

Immediate Concerns

Thanks!

QuantumFractal commented 1 year ago

This was something I was playing with, I think it hits a wall while trying to compare all rotations. Generating polycubes is relatively easy, just add a new cube adjacent to an existing one, but the complexity comes from comparing it against previously seen ones.