目录
1,魔方三要素
(1)组成部件
和三阶魔方类似,形状参考:

但是颜色不要参考这个,这个颜色设定不符合标准颜色排布。
我在网上找不到卖三阶半转魔方的,只找到外国网友自制的这个,参考Takafumi's Half turn cube
关键就是中心块不是正方形,所以每次只能旋转180度。
(2)可执行操作
和三阶魔方类似,6种操作,但是每次只能旋转180度。
(3)目标态
同三阶魔方
2,复原方法
(1)调整8个角块的位置
利用我的交换公式自动推导并采用文中的默认编号

运行:
int main()
{
CubeBlock block1(0, 8);//8角块
vector<CubeBlock>b = vector<CubeBlock>{ block1 };
Opt opt1{ { {2,3,0,1,4,5,6,7} } ,"上" };
Opt opt2{ { {0,1,2,3,6,7,4,5} } ,"下" };
Opt opt3{ { {0,1,7,6,4,5,3,2} } ,"前" };
Opt opt4{ { {5,4,2,3,1,0,6,7} } ,"后" };
Opt opt5{ { {7,1,2,4,3,5,6,0} } ,"左" };
Opt opt6{ { {0,6,5,3,4,2,1,7}} ,"右" };
CubeOpt op1(b, opt1);
CubeOpt op2(b, opt2);
CubeOpt op3(b, opt3);
CubeOpt op4(b, opt4);
CubeOpt op5(b, opt5);
CubeOpt op6(b, opt6);
vector<CubeOpt>opts = { op1,op2,op3,op4,op5,op6 };
for (int i = 0; i < opts.size(); i++)mans[i] = opts[i].getName();
Cube cube(b, opts);
cube.bfs(0, 3, 3);
return 0;
}
运行结果:
只输出一行 k=96
也就是说,不存在只有3个角块位置不对的情况。
所以,只需要随便把下面一层的4个角块中的3个归位,那么第4个角块就一定是归位的。
此时,最多只需要一次旋转操作就可以恢复所有角块的位置。
(2)调整12个棱块的位置
运行:
int main()
{
CubeBlock block1(0, 8);//8角块
CubeBlock block2(1, 12);//12侧棱
vector<CubeBlock>b = vector<CubeBlock>{ block1,block2 };
Opt opt1{ { {2,3,0,1,4,5,6,7},{2,3,0,1,4,5,6,7,8,9,10,11} } ,"上" };
Opt opt2{ { {0,1,2,3,6,7,4,5},{0,1,2,3,4,5,6,7,10,11,8,9} } ,"下" };
Opt opt3{ { {0,1,7,6,4,5,3,2},{0,1,10,3,4,5,7,6,8,9,2,11} } ,"前" };
Opt opt4{ { {5,4,2,3,1,0,6,7},{8,1,2,3,5,4,6,7,0,9,10,11} } ,"后" };
Opt opt5{ { {7,1,2,4,3,5,6,0},{0,1,2,11,7,5,6,4,8,9,10,3} } ,"左" };
Opt opt6{ { {0,6,5,3,4,2,1,7},{0,9,2,3,4,6,5,7,8,1,10,11} } ,"右" };
CubeOpt op1(b, opt1);
CubeOpt op2(b, opt2);
CubeOpt op3(b, opt3);
CubeOpt op4(b, opt4);
CubeOpt op5(b, opt5);
CubeOpt op6(b, opt6);
vector<CubeOpt>opts = { op1,op2,op3,op4,op5,op6 };
for (int i = 0; i < opts.size(); i++)mans[i] = opts[i].getName();
Cube cube(b, opts);
cube.bfs(1, 3, 3);
return 0;
}
从运行结果中随便取一个结果:
0,1,2,3,7,5,4,6,8,9,10,11,
0上 2前 0上 4左 0上 2前 0上 4左
这个公式的效果就是4 6 7号的3个棱块互换位置
分析逆序数,很容易证明,不存在最后只有2个棱块需要互换位置的情况。
所以,只需要这1个公式,就可以恢复所有棱块的位置。
(3)调整角块和棱块的朝向
所有角块和棱块的朝向一定是正确的,不用调整。
至此,魔方复原。
134万+

被折叠的 条评论
为什么被折叠?



