Chinaunix首页 | 论坛 | 博客
  • 博客访问: 818071
  • 博文数量: 756
  • 博客积分: 40000
  • 博客等级: 大将
  • 技术积分: 4980
  • 用 户 组: 普通用户
  • 注册时间: 2008-10-13 14:40
文章分类

全部博文(756)

文章存档

2011年(1)

2008年(755)

我的朋友

分类:

2008-10-13 16:14:35

What?

This page contains my various (over a hundred) implementations of the problem, or rather, its solution. Some of these are understandably weird. While some differ in the "programming language" (loosely speaking) of implementation (there's in , for example), there are many others that differ in concept.

Such As?

Consider the . This is a bootable operating system for the x86 processor that solves the Hanoi puzzle as its primary task. Then there are implementations of Hanoi running on embedded systems. There is an animated Hanoi for the Sega Game Console (). There is one for the (). There also are implementations of Hanoi as a loadable kernel module for Linux (), a system call for (), one that runs on a (), one as a that can send you Hanoi moves as ICMP echo response sequence numbers if you ping it, and write-only monstrosities such as the following :

s~^xx*$~:n:3:2:1:&:~;tB;d;:B;/^:$/d;h s~^:.:\(.\):.:\(.\):*:.*~\2 --> \1~;x /^:y:.:.:.:*:.*/b0;/^:n:.:.:.:x:.*/b1 s~:n:\(.\):\(.\):\(.:x*\)x:\(.*\)~:n:\2:\1:\3:y:\1:\2:\3x:\4~ bB;:1;x;p;x;s~^:n:.:.:.:x:\(.*\)~:\1~;bB;:0;x;p;x s~^:y:\(.\):\(.\):\(.\):x\(x*:*\)~:n:\1:\3:\2:\4~ bB

You can save the above script to a file and try "echo xxx | sed -f filename". Some sed implementations, like the one on Solaris, might choke on the above because of trailing text after labels, in which case try this , and here is a .

Why?

I am often asked that since I do all this, whether I have a lot of free time on my hands. Between my work and my interests (both of which overlap to a great extent), I actually have no free time. As an aside, I would not (and should not) be expected to "know" so many programming languages, and I don't think I do! However, I do believe that knowing a computer language is a rather fuzzy idea. If one could write a useful (loosely speaking, again) program in a given language, it is instructive to question whether one knows it.

It is ironical (yes, there is such a word) that the bigger challenge, at least in my opinion, lies not in writing programs in all these different languages and ways, but in rapidly setting up the respective compiler systems and/or development environments on an appropriate platform/operating system. Sometimes compilers, interpreters and other such software for a particular language may be readily available, and run "out of the box", but many times this is not the case. Sometimes it turns out to be a non-trivial problem to get a compiler to function (pun unintended). Of course, once you get past this, you do have to understand some subset of the language!

FAQ

If you have a comment, question or any other feedback, please check the first to see if I have responded to a similar question already.

Download

You can download all Hanoi implementations as a single (gzipped tar file), or browse and download individual implementations as listed below.

The Implementations

Name G R
N Y
N N
N Y
N Y
N Y
N Y
N Y
N Y
Y Y
N N
N Y
N N
N Y
N N
N Y
N Y
N N
N Y
N Y
N Y
N Y
N Y
N Y
N Y
N N
N Y
N Y
N Y
N N
N Y
N N
N N
Y Y
N Y
Y Y
N N
N N
N Y
N Y
N N
N Y
Y Y
N Y
N Y
N Y
N Y
Y Y
N Y
N Y
N Y
N Y
N Y
N Y
N Y
N N
N Y
N Y
N Y
N Y
N Y
N Y
N Y
N Y
N N
N Y
N Y
N Y
Y N
N N
N Y
N N
N Y
N Y
N Y
Y N
N N
Y Y
N Y
N Y
N N
N Y
N Y
N Y
N Y
N Y
N N
N Y
N Y
N Y
N Y
N Y
N N
N Y
N Y
N Y
N N
N N
N Y
N Y
N Y
N Y
N Y
N Y
N Y
Y Y
N Y
N Y
N Y
N Y
N Y

110 Hanois total. Source unavailable for 4.

Legend

Y Implementation is graphical and/or animated.
N Implementation does not use explicit recursion.


--------------------next---------------------

阅读(463) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~