kernelthread.com

Sendmail

The Towers of Hanoi implemented through Sendmail's configuration (.cf) file mechanism.

# The Towers Of Hanoi (hanoi.cf) # sendmail # Copyright (C) 1998 Amit Singh. All Rights Reserved. # http://hanoi.kernelthread.com # # Last tested with sendmail 8.12.5 (version 10 of .cf file) # # Acceptable input (number of disks) is a positive integer between # 1 and 9, both inclusive. In order to solve Hanoi for N disks, try: # # echo 99 N | sendmail -bt -d21.3 -C hanoi.cf # # To suppress the debug output, and get only the list of moves, try # the following: # # echo 99 N | sendmail -bt -d21.3 -C hanoi.cf | awk -F: '/move/{print $NF}' # V10 S99 R1 $: . R2 $: .. R3 $: ... R4 $: .... R5 $: ..... R6 $: ...... R7 $: ....... R8 $: ........ R9 $: ......... R$+ $@ $>98 1 3 2 $1 S98 R$- $- $- $* :$* $: $1 $2 $3 $4 R$- $- $- $@ $1 $2 $3 R$- $- $- . $* $: $>98 $1 $3 $2 $4 R$- $- $- $* $: $>98 $2 $3 $1 $4 :move $1 to $3 R$- $- $- $* $: $3 $2 $1 . $4 # __END__

Download

hanoi.cf