4x4x4 Programming Discussion

Status
Not open for further replies.
I was hoping there were some Meta-Rules that could be applied to avoid a search, but apparently the only alternative is to work on 24 different cube orientations in tandem.

Well, we're not "combining" orientations here, or even dealing with
orientations at all (except for fixing one of the slices to *prevent*
full-cube rotations). If you don't want to prevent whole-cube
rotations in this fashion, then much of this may not apply.

So a few questions I have are:

1. Given that there are some transposing move sequences which can:

a) create the same position on a solved cube,

and...

b) create a different position from a randomly scrambled cube...

...does this imply that the total number of unique moves possible as a function of depth from any given position might vary?

The last few messages I've written have *only* concerned themselves
with pruning the search tree of redundant move sequences, and the
only reasonable way to do this is on the supercube, which is a group,
and thus worrying about the "starting position" is not relevant.

Taking the actual position into account when pruning move sequences
is probably not going to be a win (but who knows, I might be
surprised).

It's pretty easy to evaluate, though. Just perform a search to a
particular depth using your sequence pruning, and compare the count
of sequences (equivalently, leaves in your search tree) against the
number of distinct positions found. If they are very close, then further
pruning is probably not helpful. This is assuredly the case for the 3x3x3
to extremely deep plies, and is probably the case on the 4x4x4 to the
depths we can reasonably search to.

Essentially, you define a set of canonical sequences (those generated
by your pruned tree search), and compare the count of canonical
sequences of a given length, with the count of distinct positions at a
particular distance from some particular position (typically the solved
position).

2. This goes along with question 1 somewhat. In chess, we can list every possible legal move to a certain depth, such as 1. e4 e5 2. Nf3 and 1. e4 c5 2. d4 cxd4 3. c3 dxc3 4. Nxc3, etc. Has anyone performed any auditing of the move generator output to determine if, in fact, they are all in agreement? Or has there only been node count level verification?

In general, when writing tree pruning, you *always* compare distinct
position counts both with and without the tree pruning enabled, as
deeply as you can, to ensure you're not pruning excessively. I would
assume this is being done even by you as you add whatever pruning
you are considering.

is it possible to extrapolate the list to the next depth . . .

Absolutely; this is exactly the information
codified by the finite state machine. You can easily turn it into a matrix
that will give you the count of canonical sequences of any length.

I have two matrices:

legal_move[state][move] -> boolean

In reality, this is a single-dimension array with bitmasks.

next_state[state][move] -> state

Initial state is "0". Each move gives you a bitmask of legal
next moves; picking a legal move, you can combine it with
the current state through the next_state array to get the
subsequent state.
 
Last edited:
In general, when writing tree pruning, you *always* compare distinct
position counts both with and without the tree pruning enabled, as
deeply as you can, to ensure you're not pruning excessively. I would
assume this is being done even by you as you add whatever pruning
you are considering.

The method I used was rather primitive and took advantage of the 128 GB of RAM I had access to at the time. Basically, I generated the full-width 36^nth array for depths 1 through 6. I stored every "turn" made by the 36^nth move generator, one at a time, and computed a unique index for the entire cube using a large number library. The same number used to count all of the possible arrangements on the 4x4x4 cube was my formula. If the move just made by the move generator created an index not in the list, it was a "legal move" and it was stored similar to yours, using "1" to indicate legal, and "0" to indicate not legal. But, instead of 2 dimensions, it had "n" dimensions where n was the depth.

So Legal_Moves[R][F][r2][b2][u'] would contain a 1 or 0, and I defined U to be a constant == 0, R == 1, F == 2, etc.

I thought because it took at least 4 moves to do a rotation of the cube in place, such as U D' u d', that I would need at least 4 dimensions to my matrix, whereas you had managed with just 2.

In the end, I only kept the 5-turn matrix, since the 6-turn could be generated from the 5-turn.

Absolutely; this is exactly the information
codified by the finite state machine. You can easily turn it into a matrix
that will give you the count of canonical sequences of any length.

I have two matrices:

legal_move[state][move] -> boolean

In reality, this is a single-dimension array with bitmasks.

next_state[state][move] -> state

Initial state is "0". Each move gives you a bitmask of legal
next moves; picking a legal move, you can combine it with
the current state through the next_state array to get the
subsequent state.

My thinking is this:

1. Generate all 24 solved states.
2. Store all of them in a master 1-D array with a depth of 0.
3. One by one, make one turn on each of them, generate the master 4x4x4 index, check the RAM buffer for the same index, and add it to the buffer if it is still unique.
4. Repeat the process for 2 turns, 3 turns, .... 6 turns.

In the end, I should not see moves such as D d if the move U u preceeded it, since one is a rotated version of the other.
And, once I have an "acceptable" master list through 6 plies, I can save the list to disk, and generate subsequent depths in RAM using the 6-to-7 technique,
then 7-to-8, 8-to-9, etc.

And, by the way, I found a very simple pruning idea that is 100% fully tested and known to work for plies 1, 2, and 3. With a simple statement I can tell if you are
1 move from solved, 2 moves from solved, etc., so I can do the same type of pruning as the corner prune.
 
Last edited:
There are a lot of posts in this thread (and the others) so this may already have been mentioned, but at least I haven't seen it anywhere...

One way of reducing the size of the database is to rotate the cube to a specific orientation before storing it.

The easiest way of doing this is probably to pick a specific corner piece (for example white/red/blue) and then rotate the cube until it's in a specific location (for example down/front/left).

That way you always only store each state once.

Edit : Since the database size grows exponentially, I would also recommend solving it from both the unsolved state and the target state at the same time, meeting in the middle.
 
Last edited:
There are a lot of posts in this thread (and the others) so this may already have been mentioned, but at least I haven't seen it anywhere...

One way of reducing the size of the database is to rotate the cube to a specific orientation before storing it.

Yes but there is a problem with that approach. The moves U u create a position that is identical to D' d', except the cube is rotated 90 degrees. All of the relative positions of the cubes are the same. So the question is, how do you create a move generator that "knows" D' d' is the same as U u? Well one way would be to create a database of all 24 rotated states, and flagging those that are duplicates, and pruning them from the move generator so that the game tree does not grow too fast. Then you can convert the move generator output into a run-length-encoded algorithm so that the move generator is super fast. The only problem is, you need 192 GB of RAM for this approach to be highly effective (and it is, I have an experimental version I have been working on). I managed to compress each cube position down to 28 bytes each so I have about 7,362,000,000 positions possible in my database RAM buffer.

You only need to do this once, then the move generator will produce only unique moves from the perspective of all 24 possible rotated states.

This has the added benefit of helping the brute force solver find moves that lead to solutions outside of its default orientation, something Bruce and I went on and on about for a while, mostly due to my own thick head. Take the case where you have UFr and UBr edges needing to be swapped. Holding the cube with the front facing you, apply:

l' f2 b2 U2 l U2 l' U2 r U2 r' F2 l B2 r and you have solved the cube, but it is upside down from your starting orientation. You need to be able to see this is a "distance solved = 0" condition in order to be able to announce the solution without having to check all 24 orientations every time you query the solve state. I solved this problem with 24 different "solved distance = 0" positions at the start, and letting the move generator move 1 move from each of them, labeling them "solved in 1" etc.

It was cumbersome, but it actually sped things up at the tremendous expense of RAM.

I am on the hunt for a more efficient representation of a cube position. Once I do that, the approach makes sense to release to the general public.
 
By the way, it would be great if we could "import" cube positions to analyze. I would like to propose a cube import/export protocol, if there is not one already.

Unrolled Cube Notation:

U face = 0, F = 1, R = 2, D = 3, B = 4, L = 5.

So the starting cube position would be

000000000000000011111111111111112222222222222222333333333333333344444444444444445555555555555555

The perspective of U would be F facing front and R on the right.
F is facing front with U as top R on the right and L on the left
R is facing front with U as top B on the right and F on the left
B is facing front with U as top L on the right and R on the left
L is facing front with U as top F on the right and B on the left
D is facing front with F as top R on the right and L on the left

This way we can "output" some positions, then just important them directly into our own solvers.
 
By the way, it would be great if we could "import" cube positions to analyze. I would like to propose a cube import/export protocol, if there is not one already.

Unrolled Cube Notation:

U face = 0, F = 1, R = 2, D = 3, B = 4, L = 5.

So the starting cube position would be

000000000000000011111111111111112222222222222222333333333333333344444444444444445555555555555555

The perspective of U would be F facing front and R on the right.
F is facing front with U as top R on the right and L on the left
R is facing front with U as top B on the right and F on the left
B is facing front with U as top L on the right and R on the left
L is facing front with U as top F on the right and B on the left
D is facing front with F as top R on the right and L on the left

This way we can "output" some positions, then just important them directly into our own solvers.

Suggestions:

- Just use letters for sticker colors instead of numbers.
- Use some ordering of the faces that someone else has used before.
 
How about this, unfold the cube as follows:
Code:
 U
LFRB
 D
and then output the stickers by just reading line by line, top to bottom and left to right. For each sticker give the appropriate letter (case doesn't matter). So for a 2x2x2 the solved state is UUUULLFFRRBBLLFFRRBBDDDD.

Or, if you prefer, read faces top-to-bottom-left-to-right, and inside each face read the stickers in that way (still going by the above unfolding). So for a 2x2x2 the solved state would be UUUULLLLFFFFRRRRBBBBDDDD.
 
Suggestions:

- Just use letters for sticker colors instead of numbers.
- Use some ordering of the faces that someone else has used before.

That's why I am opening it up for discussion.

So you'd rather see UUUUUUUUUUUUUUUUFFFFFFFFFFFFFFFFRRRRRRRRRRRRRRR... etc?

That makes sense, I like that idea.

I just picked Top, Front, Right to start since that is how almost everyone holds the cube. Then I just picked the opposing faces, Bottom, Back, Left.

It doesn't matter what we choose, as long as there is universal agreement in the end. Then we can test some output and the solving algos to make sure we have it all correct.
 
How about this, unfold the cube as follows:
Code:
 U
LFRB
 D
and then output the stickers by just reading line by line, top to bottom and left to right. For each sticker give the appropriate letter (case doesn't matter). So for a 2x2x2 the solved state is UUUULLFFRRBBLLFFRRBBDDDD.

Or, if you prefer, read faces top-to-bottom-left-to-right, and inside each face read the stickers in that way (still going by the above unfolding). So for a 2x2x2 the solved state would be UUUULLLLFFFFRRRRBBBBDDDD.

This is something my 4x4x4 solvers already support, with some minor differences.

In my solvers, delimiters (such as a '/') are required to separate the facelets for each face. (This also allows distinguishing a move sequence from a facelet string.) I also allow up to 9 facelets in succession of the same color to be specified by a number preceding the letter. Letters can be upper or lower case.

For example, the solved cube can be represented as:
8U8U/8L8L/8F8F/8R8R/8B8B/8D8D

I also allow WOGRBY instead of ULFRBD if you prefer to use color-based letters, as Lucas suggested. Standard color scheme is assumed. (That is, I don't allow using B for the face opposite W, for example.)

EDIT: I realize now that qqwref suggested doing either doing a whole layer at a time for the side faces, or doing each face separately. I use the latter approach.
 
Last edited:
For example, the solved cube can be represented as:
8U8U/8L8L/8F8F/8R8R/8B8B/8D8D

I like this idea too. It kind of reminds me of FEN in chess for chess problem composers.

http://en.wikipedia.org/wiki/Forsyth%E2%80%93Edwards_Notation

But isn't /r a problem? That is the hard carriage return in the old C language.

Restricting it to 9 means you can have a parser that only needs to worry about reading one byte at a time.

It is always top, left, front, right, back, bottom?

My objective is to be able to feed a text file with 1 position/line to the program, have it analyze every optimal solution, output the results, and move to the next one. This way we can time how long it takes to find solutions, perhaps finding ways to optimize the code if certain positions seem to be rather difficult solves.

Do you have a 5x5x5 solver also?

If so I'd like to see an optimal solution for:

8UUR4UR4UR2UF2U/8L8L/2FU8F8F6F/R3U8R8R5R/8B8B/8D8D
 
Last edited:
But isn't /r a problem? That is the hard carriage return in the old C language.

No. C/C++ source code uses '\r' (not '/r') to represent the ASCII carriage return character. When encountering a backslash character followed by an 'r' in an input stream, it will interpret the two characters as separate characters.

It is always top, left, front, right, back, bottom?
My facelet string parser always expects the faces enumerated in that particular order, so yes if I'm interpreting your question correctly.

I note that I really consider there to be 24 solved states, corresponding to orienting the solved cube 24 different ways.

So 8D8D/8F8F/8L8L/8B8B/8R8R/8U8U would also represent a solved state, for example.

Do you have a 5x5x5 solver also?
No.

If so I'd like to see an optimal solution for:

8UUR4UR4UR2UF2U/8L8L/2FU8F8F6F/R3U8R8R5R/8B8B/8D8D

Just noting you should have 8L8L9L (or similar) in place of 8L8L, and likewise for the other solid-color faces.
 
Thanks Bruce. In another note, I thought I found a bug in your brute force solver.

bruce_4x4x4.jpg


The scramble:

http://alg.cubing.net/?puzzle=5x5x5&type=alg&view=playback&alg=R2_U2_L2_D2_R2_U2_L2_D2_R2_U2_L2_D2_r2_u2_l2_d2_r2_u2_l2_d2_r2_u2_l2_%0Ad2_

...then I realized I entered a 5x5x5 scramble into your 4x4x4 program :)
 
Can we open-source this yet? Is there any reason we're holding back on this?

I posted much of the source code. I don't have a problem with it, but it's still not worthy of cranking on solves in full-width mode. For example, here is how I do the move U (I call it T+)

Code:
BITBOARD_4x4x4_CUBE T_PLUS(BITBOARD_4x4x4_CUBE original_4x4x4_cube)
{
		BITBOARD_4x4x4_CUBE new_cube;

		/**************************************************************************/
		/* Rotating the top will change something on every face except the bottom */
		/**************************************************************************/
		new_cube._4x4x4_bottom = original_4x4x4_cube._4x4x4_bottom;

		/******************************************************************************************/
		/* Entire row of cubes moves from right -----> front -----> left -----> back -----> right */
		/* new front = old right; new right = old back; new back = old left; new left = old front */ 
		/******************************************************************************************/
		new_cube._4x4x4_front = (original_4x4x4_cube._4x4x4_front & BITMASK_CUBE_FACE_NOT_ROW_01) | (original_4x4x4_cube._4x4x4_right & BITMASK_CUBE_FACE_ROW_01);
		new_cube._4x4x4_right = (original_4x4x4_cube._4x4x4_right & BITMASK_CUBE_FACE_NOT_ROW_01) | (original_4x4x4_cube._4x4x4_back  & BITMASK_CUBE_FACE_ROW_01);
		new_cube._4x4x4_back  = (original_4x4x4_cube._4x4x4_back  & BITMASK_CUBE_FACE_NOT_ROW_01) | (original_4x4x4_cube._4x4x4_left  & BITMASK_CUBE_FACE_ROW_01);
		new_cube._4x4x4_left  = (original_4x4x4_cube._4x4x4_left  & BITMASK_CUBE_FACE_NOT_ROW_01) | (original_4x4x4_cube._4x4x4_front & BITMASK_CUBE_FACE_ROW_01);

		/*********************************************************************************/
		/*                                 Rotate the TOP                                */
		/*********************************************************************************/
		/*                                                                               */
		/* THESE CUBE LOCATIONS BECOME....              THESE CUBE LOCATIONS             */
		/*                                                                               */
		/*                                                                               */
		/*********************************/             /*********************************/
		/*  01   *  02   *  03   *   04  */             /*  13   *  09   *  05   *   01  */
		/*********************************/             /*********************************/
		/*  05   *  06   *  07   *   08  */             /*  14   *  10   *  06   *   02  */
		/*********************************/             /*********************************/
		/*  09   *  10   *  11   *   12  */             /*  15   *  11   *  07   *   03  */
		/*********************************/             /*********************************/
		/*  13   *  14   *  15   *   16  */             /*  16   *  12   *  08   *   04  */
		/*********************************/             /*********************************/
		/*                                                                               */
		/*                                                                               */
		/*********************************************************************************/

		new_cube._4x4x4_top = ((original_4x4x4_cube._4x4x4_top & BITMASK_CUBE_FACE_SQUARE_13) << 48)  | \
							  ((original_4x4x4_cube._4x4x4_top & BITMASK_CUBE_FACE_SQUARE_09) << 28)  | \
							  ((original_4x4x4_cube._4x4x4_top & BITMASK_CUBE_FACE_SQUARE_05) << 8)   | \
							  ((original_4x4x4_cube._4x4x4_top & BITMASK_CUBE_FACE_SQUARE_01) >> 12)  | \
							  ((original_4x4x4_cube._4x4x4_top & BITMASK_CUBE_FACE_SQUARE_14) << 36)  | \
							  ((original_4x4x4_cube._4x4x4_top & BITMASK_CUBE_FACE_SQUARE_10) << 16)  | \
							  ((original_4x4x4_cube._4x4x4_top & BITMASK_CUBE_FACE_SQUARE_06) >> 4)   | \
							  ((original_4x4x4_cube._4x4x4_top & BITMASK_CUBE_FACE_SQUARE_02) >> 24)  | \
							  ((original_4x4x4_cube._4x4x4_top & BITMASK_CUBE_FACE_SQUARE_15) << 24)  | \
							  ((original_4x4x4_cube._4x4x4_top & BITMASK_CUBE_FACE_SQUARE_11) << 4)   | \
							  ((original_4x4x4_cube._4x4x4_top & BITMASK_CUBE_FACE_SQUARE_07) >> 16)  | \
							  ((original_4x4x4_cube._4x4x4_top & BITMASK_CUBE_FACE_SQUARE_03) >> 36)  | \
							  ((original_4x4x4_cube._4x4x4_top & BITMASK_CUBE_FACE_SQUARE_16) << 12)  | \
							  ((original_4x4x4_cube._4x4x4_top & BITMASK_CUBE_FACE_SQUARE_12) >> 8)   | \
							  ((original_4x4x4_cube._4x4x4_top & BITMASK_CUBE_FACE_SQUARE_08) >> 28)  | \
							  ((original_4x4x4_cube._4x4x4_top & BITMASK_CUBE_FACE_SQUARE_04) >> 48);

		return new_cube;
}

...and some of the supporting data types...

Code:
#define BITBOARD_TOP_SOLVED    0x2222222222222222
#define BITBOARD_RIGHT_SOLVED  0x3333333333333333
#define BITBOARD_FRONT_SOLVED  0x5555555555555555
#define BITBOARD_LEFT_SOLVED   0x7777777777777777
#define BITBOARD_BOTTOM_SOLVED 0xBBBBBBBBBBBBBBBB
#define BITBOARD_BACK_SOLVED   0xDDDDDDDDDDDDDDDD

#define BITMASK_CUBE_FACE_SQUARE_01 0xF000000000000000
#define BITMASK_CUBE_FACE_SQUARE_02 0x0F00000000000000
#define BITMASK_CUBE_FACE_SQUARE_03 0x00F0000000000000
#define BITMASK_CUBE_FACE_SQUARE_04 0x000F000000000000

#define BITMASK_CUBE_FACE_SQUARE_05 0x0000F00000000000
#define BITMASK_CUBE_FACE_SQUARE_06 0x00000F0000000000
#define BITMASK_CUBE_FACE_SQUARE_07 0x000000F000000000
#define BITMASK_CUBE_FACE_SQUARE_08 0x0000000F00000000

#define BITMASK_CUBE_FACE_SQUARE_09 0x00000000F0000000
#define BITMASK_CUBE_FACE_SQUARE_10 0x000000000F000000
#define BITMASK_CUBE_FACE_SQUARE_11 0x0000000000F00000
#define BITMASK_CUBE_FACE_SQUARE_12 0x00000000000F0000

#define BITMASK_CUBE_FACE_SQUARE_13 0x000000000000F000
#define BITMASK_CUBE_FACE_SQUARE_14 0x0000000000000F00
#define BITMASK_CUBE_FACE_SQUARE_15 0x00000000000000F0
#define BITMASK_CUBE_FACE_SQUARE_16 0x000000000000000F

#define BITMASK_CUBE_FACE_ROW_01 0xFFFF000000000000
#define BITMASK_CUBE_FACE_ROW_02 0x0000FFFF00000000
#define BITMASK_CUBE_FACE_ROW_03 0x00000000FFFF0000
#define BITMASK_CUBE_FACE_ROW_04 0x000000000000FFFF

#define BITMASK_CUBE_FACE_NOT_ROW_01 0x0000FFFFFFFFFFFF
#define BITMASK_CUBE_FACE_NOT_ROW_02 0xFFFF0000FFFFFFFF
#define BITMASK_CUBE_FACE_NOT_ROW_03 0xFFFFFFFF0000FFFF
#define BITMASK_CUBE_FACE_NOT_ROW_04 0xFFFFFFFFFFFF0000

#define BITMASK_CUBE_FACE_COL_01     0xF000F000F000F000
#define BITMASK_CUBE_FACE_NOT_COL_01 0x0FFF0FFF0FFF0FFF

#define BITMASK_CUBE_FACE_COL_02     0x0F000F000F000F00
#define BITMASK_CUBE_FACE_NOT_COL_02 0xF0FFF0FFF0FFF0FF

#define BITMASK_CUBE_FACE_COL_03     0x00F000F000F000F0
#define BITMASK_CUBE_FACE_NOT_COL_03 0xFF0FFF0FFF0FFF0F

#define BITMASK_CUBE_FACE_COL_04     0x000F000F000F000F
#define BITMASK_CUBE_FACE_NOT_COL_04 0xFFF0FFF0FFF0FFF0

/*****************************************/
/* Structs and their associated pointers */
/*****************************************/

typedef struct bitboard_4x4x4_cube
{
	unsigned long long _4x4x4_top;
	unsigned long long _4x4x4_right;
	unsigned long long _4x4x4_front;
	unsigned long long _4x4x4_left;
	unsigned long long _4x4x4_bottom;
	unsigned long long _4x4x4_back;
}
BITBOARD_4x4x4_CUBE, *BITBOARD_4x4x4_CUBE_PTR;

typedef BITBOARD_4x4x4_CUBE (*cube_move_ptr)(BITBOARD_4x4x4_CUBE);
cube_move_ptr cube_move_array[36];
 
Last edited:
Posting bits of code in a forum thread isn't the same as hosting the code on a code-sharing system, where one can see the code in full, create issues, and discuss the code in a better-suited format.

Git's most common these days, but I'd live with SVN or something if you had a need to be different :)

"Not done" is what alpha versions of code are for!
 
Posting bits of code in a forum thread isn't the same as hosting the code on a code-sharing system, where one can see the code in full, create issues, and discuss the code in a better-suited format.

Git's most common these days, but I'd live with SVN or something if you had a need to be different :)

"Not done" is what alpha versions of code are for!

If you want a pretty kick-ass version with the (sometimes faulty) 6-turns-from-solve database loaded into a huge 12 GB RAM buffer, here is the link:

depth_16.jpg


http://lightningcloudcomputing.com/OO_4x4x4.zip

It chops 6-plies of search off of the tree if it hits a database position, saving about 2 years of search time on deep searches.
 
Can we open-source this yet? Is there any reason we're holding back on this?

I assumed this was referring to my solver.

Anyway, I started doing some of the clean-up of the code (mainly removing some unused definitions and code from my 5-step solver or other obsolete/unused pieces of code). So I think it's close to a state where I might be willing to share it - maybe this weekend.

My other concern is other people "taking it over," creating bugs, and generally adding all sorts of stuff that I'm not interested in maintaining. I think I would prefer to maintain my own version privately, while others can take what I've done and update it for their own purposes.
 
Cube Rotation Notation

I added a new feature to the parser this morning: cube rotation.

I noticed that some of the solutions to solves shown on the alg website list rotations executed by the solvers. I'm not exactly sure which is which, but maybe someone can correct me if I am wrong.

Presently I use the following notation:

X+ = rotate the x-axis clockwise. This is TOP ---> RIGHT in my current implementation.
X- = rotate the x-axis counterclockwise. This is TOP ---> LEFT in my current implementation.
X2 = rotate the x-axis twice. This is TOP ---> BOTTOM in my current implementation.

Y+ = rotate the y-axis clockwise. This is FRONT ---> TOP in my current implementation.
Y- = rotate the y-axis counterclockwise. This is FRONT ---> BOTTOM in my current implementation.
Y2 = rotate the y-axis twice. This is FRONT ---> BACK in my current implementation.

Z+ = rotate the z-axis clockwise. This is RIGHT ---> FRONT in my current implementation.
Z- = rotate the z-axis counterclockwise. This is RIGHT ---> BACK in my current implementation.
Z2 = rotate the z-axis twice. This is RIGHT ---> LEFT in my current implementation.

Once such a move is parsed, the entire cube takes on the new position for all subsequent turns, until the next rotation change is encountered in the stream.
I can change the notation for the WCA notation folks out there when the time comes for a release.

This brings to mind another question: which rotations represent the set of all non-duplicating rotations?

I started with this set:

X+
X-
X2
Y+
Y-
Y2
Z+
Z-
Z2

For the 2-rotation combinations, I performed the rotation pair and checked the status of all existing prior rotations. If there was a duplicate, I exclude it from the unique set that follows. Of course, the order in which you pair the rotations will effect which ones stay and which ones remain. This is what I came up with:

X+Y+
X-Y+
X2Y+

X+Y-
X-Y-
X2Y-

X+Y2
X-Y2

X2Z+

X+Z+
X-Z+

X2Z-

X+Z-
X-Z-

So I have 14 legal 2-paired rotations, 9 legal 1-move rotation, and if you add the unmoved starting cube, this accounts for all 24 possible cube states. If someone would like to double-check me on this, I would appreciate it. I will use these rotated states to solve the TFS databases in a separate project now, so getting it correct from the start is very critical. Such an undertaking should finally put the rest the last remaining undesired feature in the old OO_4x4x4 program: finding the true distance from the solved state for any frame of reference. This should do wonders for the program.

rotate_sample.jpg


Translating the scramble and solve:

scramble = U F [Y+][X2] r2 d2 R2 U2 [X+][Y2] U'
solve = U R2 U2 l2 f2 L' D'
 
Last edited:
I added a new feature to the parser this morning: cube rotation.

I noticed that some of the solutions to solves shown on the alg website list rotations executed by the solvers. I'm not exactly sure which is which, but maybe someone can correct me if I am wrong.

Presently I use the following notation:

X+ = rotate the x-axis clockwise. This is TOP ---> RIGHT in my current implementation.
X- = rotate the x-axis counterclockwise. This is TOP ---> LEFT in my current implementation.
X2 = rotate the x-axis twice. This is TOP ---> BOTTOM in my current implementation.

Y+ = rotate the y-axis clockwise. This is FRONT ---> TOP in my current implementation.
Y- = rotate the y-axis counterclockwise. This is FRONT ---> BOTTOM in my current implementation.
Y2 = rotate the y-axis twice. This is FRONT ---> BACK in my current implementation.

Z+ = rotate the z-axis clockwise. This is RIGHT ---> FRONT in my current implementation.
Z- = rotate the z-axis counterclockwise. This is RIGHT ---> BACK in my current implementation.
Z2 = rotate the z-axis twice. This is RIGHT ---> LEFT in my current implementation.

Well, once again you went ahead and developed your own convention instead of taking a minute to see what the speedcubing community already uses. The following table gives the correlation between the speedcubing community's notation and yours.

Code:
Speedcubing    unsolved's
convention     convention

    x              Y+       turns same direction as R
    x'             Y-
    x2             Y2
    y              Z+       turns same direction as U
    y'             Z-
    y2             Z2
    z              X+       turns same direction as F
    z'             X-
    z2             X2

I might suggest you reconsider relabeling your axes to match the speedcubing communmity. This will make it much less confusing to the entire community.

Your two-rotation combinations appear to work to provide unique states.

Your example scrambles/solves, however, don't seem to work for me.
 
Scramble = U F x z2 r2 b2 y' R2 U2 z x2 U'
Solution = U R2 U2 d2 f2 L' D' (and others) as shown.

The latest version, 2.0.1, but still without any TFS databases, is here:

http://lightningcloudcomputing.com/OO_4x4x4_bitboard.zip

Improvements since yesterday:

1. This is a great deal faster. I noticed my compiler was set to use the lowest levels of optimizations in prior versions. I selected "optimize for speed" when compiling the latest version.
2. I also hand crafted some assembly code into areas where the profiler said there were some bottlenecks.
3. I added two pruning heuristics, nothing major, but it reduces the 36^n search tree significantly.
4. Standard notation for moves and rotations is now supported.

rotate_new_notation.jpg


Well, once again you went ahead and developed your own convention instead of taking a minute to see what the speedcubing community already uses.

Well it was about 3 O'clock in the morning when I started coding and I knew it would be easy enough to change if it wasn't as the WCA used. It took all of 45 seconds to adjust the code. I was just too curious about which of the pairs of rotations were not duplicates. I used your post above to alter the code and I am pretty sure it is working now. Search time dropped from 1:41 to under a second also, very big speed improvement.
 
Last edited:
Status
Not open for further replies.
Back
Top