解魔方编程

编程入门 行业动态 更新时间:2024-10-24 01:51:44
本文介绍了解魔方编程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想开发一个程序来解决魔方在C.我用回追踪技术这一点。这是一个非常漫长的过程,它需要大量的迭代,所以我不能够解决这个问题。

I am trying to develop a program for solving a Rubik's cube in C. I used back tracking technique for this. It is a very long process and it takes lot of iterations, so I'm not able to solve it.

请给我建议,就如何更有效地解决这个问题 - 如其他技术或采用回溯本身。在谷歌,我发现了很多快捷键解决,但我不希望使用快捷键来解决这个问题。

Please give me suggestions on how to solve this more efficiently - such as other techniques or adopting backtracking itself. In Google I found a lot of shortcuts for solving this but I don't want to solve this by using shortcuts.

推荐答案

为什么不使用人性化的解决方案和程序这一点。

Why not use a human oriented solution and program this.

您需要一些模式匹配,但它不会那么难。 (此外,还有一些解决方案的1000x1000x1000)。

You need some pattern matching, but it won't be that hard. (Besides there are programs solving the 1000x1000x1000).

的基本思想是在阶段工作:

The basic idea is to work in phases:

  • 第一层
  • 第二层
  • 第三层

有关每一层你实现了几个该回合模式X到模式X算法。 在一个阶段的每一步应该把立方体接近解决。可以通过添加一个值给每个图案(值越高被给予更多的未解决的立方体)执行此操作。您还可以添加一个困难(例如圈数),所以你可以选择根据每个难度最大的价值增益的算法(或达到用最少轮的最好成绩)。

For each layer you implement a couple of algorithms that turn pattern X into pattern X'. Each step in a phase should bring the cube close to solving. You can do this by adding a value to each pattern (where higher values are given to more unsolved cubes). You can also add a difficulty (for example the number of turns) so you can select an algorithm based on the best value gain per difficulty (or reach the best result with the least turns).

这种方法的有趣的是,如果你喜欢你可以添加新的算法和测试它们是如何经常​​被使用。所以,你可以测试每个算法的有效性。

The fun of this approach, is that you can add new algorithms if you like and test how often they are used. So you can test the usefulness of each algorithm.

如果你真的想赢得这些geekpoints,创建一个单独的语言来描述的算法,他们正在解决的模式。

If you really want to earn those geekpoints, create a separate language to describe the algorithms and the pattern they are solving.

更多推荐

解魔方编程

本文发布于:2023-11-30 20:15:20,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1651349.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:魔方

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!