k-peg-hanoi

Tower of Hanoi (using k peg)


Keywords
hanoi
License
Apache-2.0
Install
pip install k-peg-hanoi==0.1.2

Documentation

Tower of Hanoi (using k peg)

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

See hanoi --help

$ hanoi 3 3
  =               
 ===              
=====             
0----------------

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

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

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

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

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

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

              =   
             ===  
            ===== 
7----------------
$ hanoi 3 4
  =                     
 ===                    
=====                   
0----------------------

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

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

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

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

                    =   
                   ===  
                  ===== 
5----------------------
$ 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