magiccube4d
magiccube4d copied to clipboard
Add ability to read version 2 log files.
for backward compatibility.
Original issue reported on code.google.com by [email protected]
on 19 Oct 2009 at 12:42
What's even the format of the old log files?
Hello Nelson! It's been a very long time and it's great to see you again.
Do you want to look into this feature? I don't recall documenting the file format but I can give you sample solutions and try to recall what I can. For instance I remember that it started with a header like currently, followed by a dump of the stickers, though I don't recall if we used that to load up the puzzle state. That was the idea in cases where we wanted to start with a particular state, but I don't recall if we ever used it, and simply recreated it by repeating the move list. I think the move list is what really changed. I think it included rotations as first class moves, but now we just represent them with twists that includes all slices (that is -1). I could be wrong about almost anything above because I don't trust my recollection.
Nice to see you again too. Well tell me about this new log file format. ~~I can't make heads or tales of it.~~
Edit: Here's what I understand so far:
Using the example log file:
MagicCube4D 3 0 0 {4,3,3} 3
1.0 0.0 0.0 0.0
0.0 1.0 0.0 0.0
0.0 0.0 1.0 0.0
0.0 0.0 0.0 1.0
*
187,1,1 187,1,2 187,1,4 187,1,4 187,-1,1 m[ 166,1,1 6,1,1 105,-1,1 m] 105,-1,1.
It seems the first line is a simple header. If I had to guess, 3 0 0
is the minimum supported version, {4, 3, 3}
is the puzzle type, and the following 3
is it's size. The next four rows describe a 4D transformation matrix (which I won't need to concern myself with since the old log files never used these).
The asterisk *
is a separator between transformation matrix and move list. You define a twist using three state variables: A,B,C
, where A
is the sticker number (something I'd have to decode for the 4D cube unless you know where the conversion is), B
is 1
for clockwise and -1
for counterclockwise, and C
is the bitwise slice mask. You prefix a macro move list with m[
and you suffix it with m]
. The move list is terminated by the .
character.
Are there any surviving copies of the original MagicCube4D software?
That's pretty good. for reference from the code:
First Line Format: * 0 - Magic Number (unique program name for sanity check) * 1 - File Version * 2 - Scramble State * 3 - Twist Count * 4 - Schlafli Product * 5 - Edge Length
The scramble states are: SCRAMBLE_NONE = 0, // Unscrambled SCRAMBLE_PARTIAL = 1, // Some small number of scrambles SCRAMBLE_FULL = 2, // Fully scrambled SCRAMBLE_SOLVED = 3; // Was solved by user even if not currently solved
The 'm' character denotes a 'mark' (short for bookmark). The following character is the mark, and like you deduced, '[' and ']' are the beginning and ending of a move sequence, which is usually the result of a macro invocation. The pipe character '|' denotes the end of a scrambling sequence. 'S' denotes macro set-up moves.
A 'c' character denotes the 'current' move which happens when the user has undone some moves. The following moves are the ones to show if they start redoing moves. I think all of these are thrown away on file save however.
You are right about the move triplets. The sticker IDs are generated by Don's puzzle engine. You should ask Roice about them since he's the one that managed that code when we wrote the current Java/Swing version.
I'll send you the previous Windows binary via email.