0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

ヘプタモンド・パズルを解く(DLX package 使用)

Posted at

ヘキサモンド・パズルを解く(DLX package 使用)ではヘキサモンド・パズルをExact cover問題としてPyPIのDLX packageを用いて解く方法を紹介しました。
今回は最高難度のテンヨー(Tenyo) ヘプタモンド 脳ブロック 永久に遊べるパズル 難易度5 総数10万通り以上に挑戦します。

ヘプタモンドとは

ポリアモンド(Wikipedia)に簡単な説明がありますが、7個の正三角形をつなげた図形でピースは24種類、回転・鏡映で向きを考慮した種類は250個ということです。

ヘプタモンドのピース

まず24個のデータを作り前回と同様に以下の変形を行い、重複を検知してデータを作ります。ピースの名前はやはりAn Introduction to Polyiamondsを参考にしました。

  • 回転は(0,120,240)の3通り
  • 鏡映はなし・上下・左右・上下左右の4通り

ヘキサモンドと同じコードで250個の向きを考慮したデータを作ることができました。

ピース名 画像 種類(回転・鏡映)
A7 12
B7 12
C7 6
D7 6
E7 12
F7 12
G7 12
H7 12
I7 6
J7 12
L7 12
M7 6
N7 12
P7 12
Q7 12
R7 12
S7 12
T7 12
U7 12
V7 6
W7 4
X7 12
Y7 12
Z7 12

ボードの構造

ボードのセル数は$7 \times 24=168$とかなり大きいですが同じ形が6個回転対称なので、一つを作って回転して作りました。

ヘプタモンド・パズルのボード

テンヨー ヘプタモンド・パズル を解く

すでにピースとボードのデータが出来たので。前回と同じコードで答えが出ました。ただし処理時間は増えているので。1万通りを超える全解答を求めるのは無理でした。25個の解答例を表示します。

ヘプタモンド・パズルの解答例

いろいろなボードのヘプタモンド

同じサイトのHeptiamonds: Puzzles & Solutionsには数多くのヘプタモンドが掲載されています。そのうちいくつかを作成して解答を1つ求めて以下に表示します。

7x12 6x14
image.png image.png
7x12 3x28
image.png image.png
Exploded view of Snowflake 1 Snowflake 1
image.png image.png
Snowflake 2 Snowflake 3
image.png image.png
Triangle 1 Triangle 2
image.png image.png
Hexagons 1 Hexagons 2
image.png image.png
Trefoil: Hexagrams
image.png image.png
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?