简体   繁体   English

魔方 Thistlethwaite 算法,检查良好的边缘

[英]Rubik's cube Thistlethwaite algotithm, check for good edges

I'm trying to build a rubik's cube solver in C using the Thistlethwaite algorithm.我正在尝试使用 Thistlethwaite 算法在 C 中构建一个魔方解算器。

I'm storing a cube as an array of 6 uint64_t integers (Faces).我将一个立方体存储为 6 个uint64_t整数(面)的数组。
Each of this faces stores 8 colors as one byte.每个面将 8 种颜色存储为一个字节。
This structure let's me easily rotate faces using bit manipulation but I wonder if I should use something else that would be more appropriate for the Thistlethwaite algorithm.这种结构让我可以使用位操作轻松旋转面,但我想知道我是否应该使用其他更适合 Thistlethwaite 算法的东西。

The issue I'm having is checking if a cube is contained in the sub group G1 <L, R, F, B, U2,D2> From what I understand, a cube that has correctly orientated edges is contained in this subgroup.我遇到的问题是检查一个立方体是否包含在子组 G1 <L、R、F、B、U2、D2> 中。据我所知,具有正确定向边缘的立方体包含在这个子组中。 (see https://www.jaapsch.net/puzzles/thistle.htm ) (见https://www.jaapsch.net/puzzles/thistle.htm

The paper at the end of the page clearly indicates how to check if an edge is good or not but I could not find a way to implement it.页面末尾的论文清楚地说明了如何检查边缘是否良好,但我找不到实现它的方法。

The question I have is: How to check in code if an edge is correctly oriented given a scrambled cube ?我的问题是:如果给定一个加扰的立方体,如果一条边的方向正确,如何检查代码?

According to the article, page 1:根据文章,第1页:

Getting into G1进入G1

An edge piece is BAD if in taking it home an odd number of quarter-turns of U and D faces is needed;如果在带回家时需要奇数个 U 面和 D 面的四分之一圈,则边缘片是坏的; otherwise it is GOOD否则很好

A different way of putting this: if you can manage to bring an edge home without ever using a U or D turn (so only turning the L, F, R and B faces), then an edge is good , otherwise it is bad .换一种说法:如果你可以在不使用 U 或 D 转弯的情况下设法将边缘带回家(所以只转动 L、F、R 和 B 面),那么边缘是好的,否则是坏的

So let's say you have a scrambled cube and are looking at one particular edge piece.因此,假设您有一个混杂的立方体并且正在查看一个特定的边缘部分。 Identify the position where it should end up (obviously based on the centre pieces).确定它应该结束的位置(显然基于中心部分)。 Let's say that one of the two colours of this edge is red.假设这条边的两种颜色之一是红色。 Then identify where the current place of that red face is in the following image:然后确定下图中那个红脸的当前位置:

在此处输入图片说明

Do the same for the place where that red side should end up.对红色边应该结束的地方做同样的事情。

If both places have the same colour (yellow or blue) in the above image, then the edge is good .如果上图中两个地方的颜色相同(黄色或蓝色),则边缘是好的 If they have different colours in the above image, then the edge is bad .如果它们在上图中有不同的颜色,则边缘不好

You can easily see that if you had taken the other colour side of the edge in question (the not-red one), you would arrive at the same conclusion with this method.您可以很容易地看到,如果您采用了有问题的边缘的另一边(非红色),您将使用此方法得出相同的结论。

Up to you to translate this to your data structure.由您决定将其转换为您的数据结构。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM