qifen37 / cube Goto Github PK
View Code? Open in Web Editor NEWThis project forked from rockcarry/cube
This project forked from rockcarry/cube
不到 800 行代码,彻底搞定魔方还原问题 VC 可以编译运行,或者用 mingw 的 gcc 编译都可以 总共代码不到 800 行,还原速度在 10s 左右,当然还可以进一步优化。 一些符号的含义: F - 正面,程序运行后白色的这一面 B - 背面,黄色面 L - 左面,紫色面(标准魔方应该是橙色,但是 windows 控制台无法显示橙色,用紫色替代) R - 右面,红色面 U - 上面,蓝色面 D - 下面,绿色面 命令说明: 魔方操作命令: f - 正面顺时针旋转 f2 - 正面 180 度旋转 f' - 正面逆时针旋转 其他面以此类推: f2 f' b b2 b' u u2 u' d d2 d' l l2 l' r r2 r' init - 魔方复位 rand - 随机打乱魔方,可以直接 rand 或者 rand n,n 为随机打乱次数 input - 输入魔方状态,按照提示输入即可 solve - 自动还原魔方 help - 帮助信息 exit - 退出程序 所有命令都是用小写字母。 数据结构和算法说明: 数据结构方面,每个面都用简单的二维数组来表示。要点是六个面的旋转操作的实现,以及魔方状态的显示,和状态输入。 算法方面,主要是用到了启发式的广度优先搜索。要点在于魔方状态的评估函数,剪枝方法,搜索算法等。 当然,你还得懂魔方。 程序代码量不大,也写得足够精简,可仔细品味。如有不懂可以提问。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.