towers-of-hanoi

1.1.1 • Public • Published

Towers of Hanoi

A JavaScript library implementing a solution to the Towers of Hanoi problem.

How to use

import {solveHanoi, steps}  from 'towers-of-hanoi';

const n = 3;
console.log(`For ${n} disks ${steps(n)} steps are required.`);

console.log('The solution is as follows:');
for (let move of solveHanoi(n)) {
    console.log(JSON.stringify(move));
}

Example application

This application was built using this library. Github is here

Package Sidebar

Install

npm i towers-of-hanoi

Weekly Downloads

2

Version

1.1.1

License

ISC

Unpacked Size

7.13 kB

Total Files

7

Last publish

Collaborators

  • marcusjuniusbrutus