Skip to content

Animated Towers of Hanoi with an extended twist. Built in JavaFX to visualize recursion — classic + custom variant. Full control, clean UI.

Notifications You must be signed in to change notification settings

tahminer/Extended-Hanoi-Javafx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Extended Hanoi — JavaFX

A visual, interactive implementation of both the classic Towers of Hanoi and an extended variant, built using JavaFX in IntelliJ IDEA.


🧩 What Is Towers of Hanoi?

Towers of Hanoi is a classic recursive puzzle involving:

  • 3 pegs
  • A stack of disks (different sizes) on one peg
  • The goal: move the entire stack to another peg

Rules:

  1. Only one disk may be moved at a time.
  2. Only the top disk can be moved.
  3. A larger disk may not be placed on a smaller one.

The minimum number of moves required is 2^n - 1, where n is the number of disks.


🔄 What Is Extended Hanoi?

In this project, we implement not only the classic version, but also an Extended Towers of Hanoi variant — a custom recursive formulation that:

  • Repeats the standard 3-step recursion, both forward and in reverse
  • Does not aim for minimal move count, but instead emphasizes recursive depth and disk activity
  • Produces a longer sequence of moves, showing off the process more dramatically

Why Use It?

  • Makes recursion behavior more visible
  • Useful for educational demonstration
  • Offers a contrast with the minimal-move classic version
  • Enables a more engaging animation for larger disk counts

In code:

  • Hanoi(...): classic algorithm (minimal solution)
  • exHanoi(...): extended version (longer, richer sequence)

💡 What This Project Does

  • Choose number of disks at launch
  • Visual board with animated pegs and disks
  • Manual or automated solution playback
  • Pause, resume, and restart functionality
  • Clean JavaFX + FXML UI using JFoenix buttons

🚀 Tech Stack

  • Java 17+ or 21
  • JavaFX (controls + FXML)
  • JFoenix (for styled buttons)
  • Built in IntelliJ IDEA

▶️ How to Run (IntelliJ)

  1. Open the project in IntelliJ IDEA.
  2. Set the Project SDK to JDK 17 or newer.
  3. Run the Main class.

About

Animated Towers of Hanoi with an extended twist. Built in JavaFX to visualize recursion — classic + custom variant. Full control, clean UI.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages