![]() |
Revolving Century Puzzle and Magic Squares - Cleve Moler on Mathematics and Computing
The Revolving Century puzzle is a beautifully made wooden puzzle from [URL="https://www.creativecrafthouse.com/"]Creative Crafthouse[/URL] in Hudson, Florida.
The sum of the numbers on each of the six rotating puzzle pieces is 100. The goal is to rotate the pieces so that the sum for each of the six columns is also 100. It is like a circular 6-by-6 magic square. [IMG]http://blogs.mathworks.com/cleve/files/start.png[/IMG] [B]Contents[/B] [LIST][*][URL="#370f5ced-4a82-475a-a76b-65fd1b2a7bb7"]Digital Version[/URL][*][URL="#c1a4a056-9449-4e06-b815-9d6a39b356bb"]State[/URL][*][URL="#89c70e0c-1c00-487f-9231-5089993f00c4"]Move[/URL][*][URL="#e7b4e63f-911d-498e-b8d5-7db3f9ebb8b7"]Search[/URL][*][URL="#5bf0e80f-113f-44e0-8c18-fbd782201f99"]Magic[/URL][*][URL="#a233dce1-c8e7-4952-9d4f-e1c668c44e38"]Solution[/URL][*][URL="#c80f5fc6-c4ef-4d9f-b617-4d868c466333"]Software[/URL][/LIST][B]Digital Version[/B] Our digital version of the Revolving Century puzzle uses 36 [URL="https://blogs.mathworks.com/cleve/2022/08/21/polygons-polyshapes-and-puzzles/"]polyshapes[/URL] like this one. [IMG]http://blogs.mathworks.com/cleve/files/piece19.png[/IMG] [IMG]http://blogs.mathworks.com/cleve/files/m_start.png[/IMG] The pieces are numbered with the integers from zero to 35, except the piece numbered 30 has been replaced by a second zero. This gives the desired "century" sum. v = 0:35; v(v==30) = 0; c = sum(v)/6 c = 100[B]State[/B] The state of the puzzle is described by a 6-by-6 matrix. A = start A = 1 4 25 29 6 35 18 5 34 33 0 10 19 24 2 26 8 21 28 13 32 0 11 16 12 14 23 7 27 17 15 20 22 31 3 9The row sums are all equal, but the column sums are not. rows = sum(A') cols = sum(A) rows = 100 100 100 100 100 100 cols = 93 80 138 126 55 108[B]Move[/B] A puzzle move rotates one row of the state matrix, for example, the third row. shift = [2:6 1]; r = 3; A A(r,:) = A(r,shift) A = 1 4 25 29 6 35 18 5 34 33 0 10 19 24 2 26 8 21 28 13 32 0 11 16 12 14 23 7 27 17 15 20 22 31 3 9 A = 1 4 25 29 6 35 18 5 34 33 0 10 24 2 26 8 21 19 28 13 32 0 11 16 12 14 23 7 27 17 15 20 22 31 3 9Since we have a computer handy, we can also track the column sums. [IMG]http://blogs.mathworks.com/cleve/files/piece19.gif[/IMG] [B]Search[/B] The only way to find a solution that I know of is an exhaustive search. There are only 6^5 = 7776 possible states. It takes 4787 steps and less than a tenth of a second on my laptop to find the solution. Here are the last few steps of the exhaustive search for a solution. [IMG]http://blogs.mathworks.com/cleve/files/polypuzzle.gif[/IMG] [B]Magic[/B] I could have used an actual magic square. A = magic(6) A = 35 1 6 26 19 24 3 32 7 21 23 25 31 9 2 22 27 20 8 28 33 17 10 15 30 5 34 12 14 16 4 36 29 13 18 11I would need to change the name of the puzzle to "Revolution 111". [IMG]http://blogs.mathworks.com/cleve/files/magic6.gif[/IMG] [B]Solution[/B] Here is the solution of the original Revolution Century puzzle. A = solution A = 25 29 6 35 1 4 33 0 10 18 5 34 21 19 24 2 26 8 11 16 28 13 32 0 7 27 17 12 14 23 3 9 15 20 22 31[IMG]http://blogs.mathworks.com/cleve/files/m_solution.png[/IMG] I can transfer that to the analog puzzle. [IMG]http://blogs.mathworks.com/cleve/files/solution.png[/IMG] [B]Software[/B] A self-extracting archive for polypuzzle is available [URL="https://blogs.mathworks.com/cleve/files/Puzzle_mzip.m"]here[/URL]. [RIGHT][COLOR=gray][I] [URL="javascript:grabCode_f1d26faf2b644b55b95e3995bb8d7cdb()"][I]Get the MATLAB code (requires JavaScript)[/I][/URL] Published with MATLAB® R2024b [/I][/COLOR][/RIGHT] |
所有时间均为北京时间。现在的时间是 03:22。 |
Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.