unsolved
Veteran
I thought it might be a good idea to stratify the discussions about 4x4x4 programming from the discussions about the associated 4x4x4 brute force solvers. Some readers who messaged me on here mentioned they were "getting lost" in some of the technical talk. Also, if you follow the strictest interpretations of the guidelines, I found myself talking about my program in Bruce's area, and sometimes Bruce would include a reference to his program in my area, so rather than "blur the lines" I offer this mutual programming discussion area.
To start things off, let me say that I have decided to re-code my move generator completely from scratch. Sometimes when you get started on a project, by the time you make some serious progress, one of the things you come to realize is how NOT to tackle the problem. It became apparent from Bruce's Rotational Scramble example that my move generator would flounder in the attempt to come up with the optimal solution because one sequence of moves functionally turned the cube by 90 degrees. In trying to find an optimal solution for the original, un-rotated version of the cube, my program was missing some obviously shorter solutions in the rotated state. There was a "quick fix" to address this particular issue, but I preferred a holistic solution to address the more general case.
I'd like to begin here with a discussion about the true "legal position" counts as a function of depth. From one of the early posts in another area:
The issue with using such rules (above) to create a move generator is that the move sequence U D' u d'would be disallowed, as would U2 D2 u2 d2, both of which create rotated versions of the cube. I created a move generator that allows those moves, since I generated every possible 36 * 33^(n-1) cube arrangement, loaded the unique positions into a RAM buffer, and scanned the buffer prior to allowing a new entry, verifying (the hard way) that no duplicates were created (including recreating the starting position). These are the numbers I get:
[table="width: 225, class: grid"]
[tr]
[td]n[/td]
[td]Explicit Unique Counts[/td]
[/tr]
[tr]
[td]1[/td]
[td]
[/tr]
[tr]
[td]2[/td]
[td]
[/tr]
[tr]
[td]3[/td]
[td]
[/tr]
[tr]
[td]4[/td]
[td]
[/tr]
[tr]
[td]5[/td]
[td]
[/tr]
[tr]
[td]6[/td]
[td]
[/tr]
[tr]
[td]7[/td]
[td]
[/tr]
[/table]
My move generator and turns-from-solution (TFS) databases absolutely require uniqueness in order to function properly, so it is imperative that I get these numbers right! We have already seen those "odd solutions" that older version of my program found, since essentially the index "matching" the position was, in fact, pointing to a database slot for a position that was out of synch due to duplicates occupying indices that should have been discarded.
In this new version, it should be noted that U u and D' d' create different positions, and are therefore both allowed.
If possible, I would like confirmation of these numbers before I launch the rest of my re-coding effort.
To start things off, let me say that I have decided to re-code my move generator completely from scratch. Sometimes when you get started on a project, by the time you make some serious progress, one of the things you come to realize is how NOT to tackle the problem. It became apparent from Bruce's Rotational Scramble example that my move generator would flounder in the attempt to come up with the optimal solution because one sequence of moves functionally turned the cube by 90 degrees. In trying to find an optimal solution for the original, un-rotated version of the cube, my program was missing some obviously shorter solutions in the rotated state. There was a "quick fix" to address this particular issue, but I preferred a holistic solution to address the more general case.
I'd like to begin here with a discussion about the true "legal position" counts as a function of depth. From one of the early posts in another area:
- if there are 2 moves on the same axis, both turn in the same direction (U is the same direction as d') and one of the moves is of <D>, then ignore the case.
- if there are 3 moves on the same axis, and >=2 moves turn in the same direction, then ignore the case.
- ignore all cases with 4 moves on the same axis.
Using this rules, if get the following numbers of valid sequences:
[table="width: 450, class: grid"]
[tr]
[td]n[/td]
[td]all
36*33^(n-1)[/td]
[td]canceling moves
(U d U = U2 d)[/td]
[td]cancel by rotation
(U u = d D)[/td]
[/tr]
[tr]
[td]0[/td]
[td]1[/td]
[td]1[/td]
[td]1[/td]
[/tr]
[tr]
[td]1[/td]
[td]36[/td]
[td]36[/td]
[td]36[/td]
[/tr]
[tr]
[td]2[/td]
[td]1.188[/td]
[td]1.026[/td]
[td]999[/td]
[/tr]
[tr]
[td]3[/td]
[td]39.204[/td]
[td]28.836[/td]
[td]27.288[/td]
[/tr]
[tr]
[td]4[/td]
[td]1.293.732[/td]
[td]810.891[/td]
[td]746.562[/td]
[/tr]
[tr]
[td]5[/td]
[td]42.693.156[/td]
[td]22.803.120[/td]
[td]20.421.648[/td]
[/tr]
[tr]
[td]6[/td]
[td]1.408.874.148[/td]
[td]641.245.896[/td]
[td]558.627.948[/td]
[/tr]
[/table]
The issue with using such rules (above) to create a move generator is that the move sequence U D' u d'would be disallowed, as would U2 D2 u2 d2, both of which create rotated versions of the cube. I created a move generator that allows those moves, since I generated every possible 36 * 33^(n-1) cube arrangement, loaded the unique positions into a RAM buffer, and scanned the buffer prior to allowing a new entry, verifying (the hard way) that no duplicates were created (including recreating the starting position). These are the numbers I get:
[table="width: 225, class: grid"]
[tr]
[td]n[/td]
[td]Explicit Unique Counts[/td]
[/tr]
[tr]
[td]1[/td]
[td]
36
[/td][/tr]
[tr]
[td]2[/td]
[td]
1,026
[/td][/tr]
[tr]
[td]3[/td]
[td]
28,812
[/td][/tr]
[tr]
[td]4[/td]
[td]
806,694
[/td][/tr]
[tr]
[td]5[/td]
[td]
22,575,425
[/td][/tr]
[tr]
[td]6[/td]
[td]
631,793,942
[/td][/tr]
[tr]
[td]7[/td]
[td]
17,681,379,137
[/td][/tr]
[/table]
My move generator and turns-from-solution (TFS) databases absolutely require uniqueness in order to function properly, so it is imperative that I get these numbers right! We have already seen those "odd solutions" that older version of my program found, since essentially the index "matching" the position was, in fact, pointing to a database slot for a position that was out of synch due to duplicates occupying indices that should have been discarded.
In this new version, it should be noted that U u and D' d' create different positions, and are therefore both allowed.
If possible, I would like confirmation of these numbers before I launch the rest of my re-coding effort.
Last edited: