Metadata-Version: 2.4
Name: k-peg-hanoi
Version: 0.2.6
Summary: Tower of Hanoi (using k peg)
Author: Saito Tsutomu
Author-email: Saito Tsutomu <tsutomu7@hotmail.co.jp>
License-Expression: Apache-2.0
License-File: LICENSE
Classifier: Development Status :: 4 - Beta
Classifier: Programming Language :: Python
Classifier: Topic :: Software Development
Classifier: Topic :: Scientific/Engineering
Requires-Dist: typer>=0.27.3
Requires-Python: >=3.11
Project-URL: docs, https://saitotsutomu.github.io/k-peg-hanoi/
Project-URL: homepage, https://github.com/SaitoTsutomu/k-peg-hanoi
Description-Content-Type: text/markdown

# Tower of Hanoi (using k peg)

Solves the Tower of Hanoi with any number of rods (3 or more) in as few moves as possible.
It shows each move on the command line, and also provides a Python function that returns the moves.

## Install

```sh
pip install k-peg-hanoi
```

## Usage (`hanoi {disk#} {rod#}`)

- `disk#`: number of disks
- `rod#`: number of rods, default 3
- `--text`: show moves as text instead of drawing the towers

See `hanoi --help`

```sh
$ hanoi 3 3
  =               
 ===              
=====             
0----------------

 ===              
=====         =   
1----------------

=====  ===    =   
2----------------

        =         
=====  ===        
3----------------

        =         
       ===  ===== 
4----------------

  =    ===  ===== 
5----------------

             ===  
  =         ===== 
6----------------

              =   
             ===  
            ===== 
7----------------
```

```sh
$ hanoi 3 4
  =                     
 ===                    
=====                   
0----------------------

 ===                    
=====   =               
1----------------------

=====   =    ===        
2----------------------

        =    ===  ===== 
3----------------------

                   ===  
        =         ===== 
4----------------------

                    =   
                   ===  
                  ===== 
5----------------------
```

```sh
$ hanoi 4 4 --text
#1 disk 1 from 0 to 1
#2 disk 2 from 0 to 3
#3 disk 3 from 0 to 2
#4 disk 2 from 3 to 2
#5 disk 4 from 0 to 3
#6 disk 2 from 2 to 0
#7 disk 3 from 2 to 3
#8 disk 2 from 0 to 3
#9 disk 1 from 1 to 3
```
