ハノイの塔とは?

無料のオンライン ハノイの塔パズルゲーム。古典的な再帰的思考トレーニングゲーム。

The Tower of Hanoi is a classic mathematical puzzle invented by French mathematician Edouard Lucas in 1883. It consists of three pegs and a stack of disks of different sizes. The objective is to move the entire stack from the first peg to the last peg, following three simple rules: only one disk can be moved at a time, only the top disk on a peg can be moved, and no larger disk may be placed on a smaller one.

Start by selecting the number of disks (3 to 7). More disks exponentially increase the difficulty — the minimum number of moves required is 2^n - 1. With 3 disks, you need at least 7 moves. With 7 disks, you need 127 moves. The puzzle is a perfect demonstration of recursive thinking: to move n disks, you first move n-1 disks to the auxiliary peg, then move the largest disk, then move the n-1 disks on top of it.

Click a peg to pick up the top disk, then click another peg to place it. The game enforces the rules visually: if you try to place a larger disk on a smaller one, the move is rejected. The move counter tracks how many moves you have made, displayed against the minimum possible moves.

The Auto Solve feature demonstrates the optimal recursive solution. Watch as the algorithm efficiently moves all disks to the target peg in exactly 2^n - 1 moves. Each move is animated so you can study the pattern. The visual win detection triggers congratulations when you complete the puzzle.

ハノイの塔の実際の使用例

3枚の円盤で再帰的な問題解決を学ぶ

プログラミングの生徒が3枚の円盤から始めます。最小手数は7手です。手作業で12手をかけて解こうとします。次に「Auto Solve」をクリックして、最適な7手の解答を見ます。再帰のパターンが明確になります。2枚をBに移動し、最大の円盤をCに移動し、BからCへ2枚を移動します。

7枚の円盤に挑戦する

経験豊富なパズル愛好家が7枚の円盤を選択します。最小手数は127手です。手数カウンターで進捗を確認しながら、20分以上かけて解いていきます。再帰的な戦略が不可欠です。個々の円盤の移動ではなく、より小さな部分問題として考えます。

教室で再帰アルゴリズムをデモする

コンピュータサイエンスの教師が4枚の円盤でハノイの塔を披露します。まず生徒が手作業で試します。次に「Auto Solve」が最適な15手の解答をデモします。教師は重要な手順ごとに一時停止して説明します。「ここで3枚の円盤をCを補助に使ってAからBへ移動します」

なぜハノイの塔を使うのか?

  • 3〜8枚の円盤
  • ドラッグ&ドロップ操作
  • 移動カウンターと最小移動数を表示
  • オートソルブ機能

ハノイの塔の使い方 — ステップバイステップ

1

円盤の数を選択します(3〜8)。

2

ルールを確認します:一度に1枚、大きい円盤の上に小さい円盤のみ。

3

円盤をドラッグしてAからCに移動します。

4

最小移動数を表示します。

ハノイの塔はこんな方におすすめ

  • 教育
  • アルゴリズム学習
  • 問題解決
  • 子どもの論理的思考

ハノイの塔のプロのヒント

  • 1n枚の円盤の最小手数は2^n - 1です。3枚なら7手、4枚なら15手、5枚なら31手、6枚なら63手、7枚なら127手です。指数関数的に増えるため、8枚以上は手作業での解決が現実的ではありません。
  • 2再帰的な解法はシンプルなパターンに従います。n枚を起点から目標へ移動するには、(1) n-1枚を起点から補助へ移動し、(2) 最大の円盤を起点から目標へ移動し、(3) n-1枚を補助から目標へ移動します。
  • 3円盤が奇数枚のとき、最初の移動先は目標の杭です。偶数枚のときは補助の杭に移動します。このパターンで総手数を最小化できます。
  • 4ハノイの塔は、問題解決戦略の心理学研究や、再帰を教えるコンピュータサイエンスのカリキュラムで使われます。また、遂行機能のロンドン塔テストの基礎にもなっています。

ハノイの塔 — よくある質問

What is the minimum number of moves?

For n disks, the minimum is 2^n - 1 moves. For 4 disks, that's 15 moves. For 7 disks, that's 127 moves.

Why can't I place a larger disk on a smaller one?

That's the rule! The puzzle requires that disks are always in decreasing size from bottom to top on every peg.

Are these games and tools free to use?

Yes, all interactive tools, games, and visualizations are completely free with no limits, ads, or paywalls. They run entirely in your browser.

Do I need a powerful computer to run these?

No. The tools are optimized for performance on standard hardware. Pixel art, fractals, and sorting visualizations run smoothly on most devices including tablets.

Is ハノイの塔 really free to use?

Yes, ハノイの塔 is completely free with no hidden charges, no usage limits, and no premium tiers. You can use it as often as you need without signing up or providing any personal information.

ハノイの塔を今すぐ試す

無料オンラインツール — ブラウザで動作、サインアップ不要。今すぐ使い始められます。

今すぐ試す
Free Forever · No Sign-up

182 Free Tools at Your Fingertips

All free online tools for developers, designers, students, and creators. Every tool works in your browser — no sign-up, no data collection.