Move all the disks from the left hand post to the right hand post, only moving the disks one at a time and a bigger disk can never be placed on a smaller disk.

Overview

Hanoi Tower

Description

The Tower of Hanoi was a famous problem posed by a mathematician in 1883, The "puzzle" is to move all the disks from the left hand post to the right hand post, only moving the disks one at a time and a bigger disk can never be placed on a smaller disk. Originally, the example had five disks. The exercise was to change it to be a non-fixed disk limit by adding an input control.


Purpose

This was done as an assignment in the MIT course - Full Stack Development with Mern


Technologies Used

  • HTML
  • CSS
  • Javascript

Installation

  • Clone this repository to your local machine

How to Run

  • Browse to the directory where you cloned this repository
  • Open the .html file in a browser (Chrome, Edge, Safari, Firefox)
  • Change the # of disks you want to solve (Min: 2 / Max: 10)
  • Click the 'Load Disks' button - this will add the disks to the 1st peg
  • You can either Manually move through the moving of the disks by clicking the 'Make Move' button, or have the browser complete all the moves for you by clicking the 'Auto Run' button
  • When all moves are complete a popup message telling you that the 'Tower is Finished' along with how many moves it took to complete

Improvements Made

  • 2022-02-05: Added ability to make # of disks specified by user
  • 2022-02-05: Added ability to load the 1st peg with the number of disks selected/entered
  • 2022-02-05: Added ability to auto run through the movement of the disks from start to end
  • 2022-02-05: Added the total movements to the popup message
  • 2022-02-05: Added ability to clear the disks and start over
  • 2022-02-05: Added check for # of disks: >2 *1 is pointless / <10 *your machine if older will thank me
  • 2022-02-05: Enabling/Disabling buttons based on what should be allowed

Roadmap of Future Improvements

  • Space out the pegs further, after 8 disks, the disks blend together when disk 9 & 8 are in side by side pegs
  • Randomize the color of disks to give a better visualization of what disk is being moved

Files

  • /images/HanoiTower.jpg - Used in the Readme file
  • index.html - Start-up file to be opened by browse
  • styles.css - Stylesheet file that positions objects, controls text, colors, and layout
  • tower.js - Javascript file manipulating what is occuring in the browser
  • hanoi.js - Javascript file that builds the pegs and disks

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.


License

The MIT License (MIT)

You might also like...

A real time Web-App for one to one chatting.

A real time Web-App for one to one chatting.

We-Vibe A real time web-app for one to one chatting. The project is broadly divided into two parts - Server and Public (client). The Socket.io module

Dec 15, 2022

This project entails a To-do-List whereby a user can input the tasks they want to do, check the tasks done and also clear all tasks when all of them are completed. It is efficient for a user who want to manage their time and keep track of their day.

This project entails a To-do-List whereby a user can input the tasks they want to do, check the tasks done and also clear all tasks when all of them are completed. It is efficient for a user who want to manage their time and keep track of their day.

Screenshot Here is a screenshot for the project. To-Do-List Project This is a Microverse project that entails a to-do-list which one is able to add an

Jun 16, 2022

A time-based one-time password (TOTP) generator and authenticator for Gun DB

A time-based one-time password (TOTP) generator and authenticator for Gun DB

Entangler A time-based one-time password (TOTP) generator and authenticator for Gun DB Entangler generates a 6 digit passcode every 30 seconds. It gen

Nov 9, 2022

Please do not use this tracker to scam anyone! This is free and will be forever free. This tracking will never ask for seed phrases nor private keys. Keep safe!

CryptoBlades Tracker Related modules express - web application framework for node pug - template engine stylus - pre-processor CSS mongoose - nodejs o

Oct 13, 2022

Timers for Lost Ark bosses, islands, events, wandering merchants and more! Never miss an event again.

Timers for Lost Ark bosses, islands, events, wandering merchants and more! Never miss an event again.

Timers for Lost Ark bosses, islands, events, wandering merchants and more! Never miss an event again. LostArkTimer.app Website Website Features Event

Oct 17, 2022

And idea that never worked but was fun while it lasted

THIS IDEA WAS FUN BUT IS DEAD NOW AND SHOULD NOT BE TRUSTED FOR ANYTHING!!! Authsio Core Core authsio web application for identity & access management

Oct 20, 2022

🌈 GitHub following, followers, only-following, only-follower tracker 🌈

🌈 GitHub following, followers, only-following, only-follower tracker 🌈

github-following-tracker GitHub following, followers, only-following, only-follower tracker πŸ‘€ Just enter your GitHub name and track your followings!

Jun 15, 2022

A community-centric site like you've never seen before.

Kleptonix A community-centric site like you've never seen before. Overview This section will be updated when basic posting and account creation functi

Apr 19, 2022

Read without losing the plot. Well Read helps you organize your notes about books you're reading, so you're never lost when starting a new volume.

Read without losing the plot. Well Read helps you organize your notes about books you're reading, so you're never lost when starting a new volume.

Well Read Well Read is a website for tracking your reading of long book series. I made this to track how many pages I read in a session and to better

Dec 15, 2022
Owner
Dustin J Sellers
Dustin J Sellers
Download all Moodle files with one click. This is a Chrome extension built to save time and effort from downloading files manually one by one!

Moodle Downloader Extension Moodle downloader extension for Chrome. The extension is tested with both the TUM moodle and the official moodle demo. Not

Zhongpin Wang 8 Nov 15, 2022
A simple extension that shows how many days a user has left until the date of the deadline

A simple extension that shows how many days a user has left until the date of the deadline

Mohamed Haddi 10 Nov 18, 2022
Tag cloud plugin for jQuery, showing bigger tags in the center

jquery.tagcloud v1.2.0 Tag cloud plugin for jQuery, showing bigger tags in the center. Usage There are two ways to define a tag cloud: Use ul and li H

Peter Thoeny 1 Jun 30, 2022
Allow moving/copying/and creation embeds for blocks with drag-n-drop just like Logseq or Roam

Demo Features Drag-n-drop for list items in the same pane and between different panes 3 modes: move block, copy block, embed block Automatic reference

null 92 Dec 26, 2022
A to-do-list project is about keeping the track of all the daily task. This application can add move or delete task.

TO-DO LIST This is a project that create a simple todo tool that help you organize your day. This is build using ES6 and webpack. Built With HTML CSS

suzana marsela 8 Oct 26, 2022
A free and open source file compression tool, Compressor makes your files smaller!

Compressor A free and open source file compression tool, Compressor makes your files smaller! Languages: ???? δΈ­ζ–‡ | ???? English Feature Internationali

δΊ”ζœˆε› 100 Dec 24, 2022
This project scans yandex disk folders that are open to public sharing and allows you to download their contents.

kitapbar.com Development start mongodb server docker-compose -f docker-compose.dev.yaml up -d yandex service cd services/yandex create a .env file by

Xinor 14 Oct 15, 2022
A demo to show how to re-use Eleventy Image’s disk cache across Netlify builds.

Re-use Eleventy Image Disk Cache across Netlify Builds Live Demo This repository takes all of the high resolution browser logos and processes them thr

Eleventy 9 Apr 5, 2022
Simple format that serves it's one and only purpose and that's creating simple task list everywhere where you can write plain text

SWTF (Simple Worklog Task Format) Simple format that serves it's one and only purpose and that's creating simple task list everywhere where you can wr

null 4 Apr 4, 2022