Labfans是一个针对大学生、工程师和科研工作者的技术社区。 论坛首页 | 联系我们(Contact Us)
MATLAB爱好者论坛-LabFans.com
返回   MATLAB爱好者论坛-LabFans.com > 其它 > 资料存档 > MATLAB技术文章
MATLAB技术文章 MATLAB Technical Articles From Mathworks
 
 
主题工具 显示模式
旧 2022-09-26, 04:29   #1
poster
高级会员
 
注册日期: 2019-11-21
帖子: 3,006
声望力: 66
poster 正向着好的方向发展
默认 Trio, A Wooden Puzzle from the Czech Republic - Cleve Moler on Mathematics and Computing

"Clever Toys" is a puzzle company in the Czech Republic. Their Web site describes five different hand-made, wooden puzzles that are related mathematically to the Rubik's Cube.

Contents
Puzzle

Here is the photo of the puzzle "Trio".



Here is an English translation of their description.

The task of this 2D puzzle is to assemble all the ovals accordingto their color into a basic assembly. By moving the balls in thegrooves and turning the center wheel, you can gradually get eachball where you need it.



I am not sure that Clever Toys is still in business. They have not responded to my emails and I have not been able to purchase an actual Trio puzzle. Of course, that is all the motivation I need to make a MATLAB model.

Model

Here is the initial configuration. There are three fixed outer, partial, discs and one inner, full, disc. Each of the outer discs has a channel containing 10 marbles. When the inner disc is positioned properly, the marbles in a channel can be rotated. Rotating the inner disc itself moves some, but not all, of the marbles, thereby scrambling the colors.

Like Rubik's Cube, the objective of the puzzle is to return to this initial "solved" state.



Mathematically, both Rubik's Cube and Trio are ultimately based upon rotation matrices. Rubik's Cube is a 3-D puzzle whose state is specified by the position and orientation of 27 cubelets; there are six colors and, at each step, 12 possible rotations. This gives Rubik's Cube about 4.3*10^19 possible positions.

Trio is a 2-D puzzle whose state is specified by the colors of 10 marbles in each of three channels; there are 10 marbles of each of three colors and, at each step, eight possible rotations (four discs, clockwise or counter-clockwise.) This implies that Trio has fewer than 3^30 = 2.1*10^14 possible positions.

Scramble

A "scramble" is an integer vector with elements between -4 and +4 that specify moves or rotations. Move 0 initializes the model. Move d with d equal to 1, 2, or 3 rotates all the marbles in the d-th channel counter-clockwise for one-tenth of a full rotation. Move d with d equal to -1, -2, or -3 is the corresponding clockwise rotation. Moves -4 and 4 turn the central disc clockwise or counter-clockwise for one-third of a full rotation. This rotates some, but not all, of the marbles and mixes the colors.

Here is a scramble of length 29 that provides our example.

D = [ 4 1 3 1 1 -2 3 1 4 4 2 4 4 -3 -3 -2 -3 -3 2 1 4 -1 3 -4 2]

And here is the scrambled result.



Animation

This animated gif shows the scrambling process one move at a time. The animation does not repeat automatically, so to start it over again, refresh your browser. If it still doesn't move, find another browser.



Unscramble

Reverse the scramble by running it backwards, changing the sign of each move. This will return the scrambled position to the initial position. I call this "unscramble"; it solves the scrambled position by a "follow the breadcrumbs" algorithm.

Both animations take a long time to run -- about 80 seconds with my browser.



Solutions

I don't have any idea about how to actually solve a given position without using knowledge of how it was generated, and I don't have any idea about how to quantify the difficulty of finding a solution. This is in sharp contrast to Rubik's Cube where there are measures of difficulty and algorithms for finding optimum solutions.

Software

The program available at this link is interactive. Click or alt-click in any one of the four discs to make a move in that disc.


Get the MATLAB code (requires JavaScript)

Published with MATLAB® R2022a
poster 当前离线   回复时引用此帖
 


发帖规则
不可以发表新主题
不可以发表回复
不可以上传附件
不可以编辑自己的帖子

启用 BB 代码
论坛启用 表情符号
论坛启用 [IMG] 代码
论坛启用 HTML 代码



所有时间均为北京时间。现在的时间是 19:47


Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.