bob wrote:Tord Romstad wrote:Michel wrote:Writing an interface is easy for an experienced programmer but writing a good chess program from scratch is extremely difficult.
Actually, it's the other way around. I've done both in Mac OS X, and writing a chess engine is at least an order of magnitude easier. On the iPhone, the difference is even bigger. Designing a good interface for the tiny screen and finger input is a very difficult task.
Tord
I don't agree, for several reasons. First, 99.99% of programmers have absolutely no idea how alpha/beta works.
Even if we assume that your 99.99% figure is right (I think it is
way too high, and should be closer to 90%), it doesn't change much. Alpha/beta is trivial to explain and understand.
About one year ago, I gave a one-hour lecture to my colleagues, where I explained how Glaurung's parallel search worked. The audience had rather mixed backgrounds, like mathematical logic, cognitive science, psychology, computer science, and plain software engineering. None of them had ever implemented alpha/beta before, although a couple of them recalled having seen the algorithm in textbooks. I explained negamax, alpha-beta pruning, and the importance of good move ordering, and why the most obvious ways to parallelize alpha/beta are very inefficient. I proceeded to explain YBWC and the helpful master concept, and how my implementation in Glaurung works. Nobody seemed to have any problems understanding the lecture. I got lots of intelligent and interesting questions, and even a few suggestions for possible improvements.
Of course, the reason why alpha/beta now seems trivial is the hard work done by you and other pioneers. Most brilliant new ideas are very hard to grasp in the beginning, but gradually become easier when they become better understood and the presentation is polished. As an example, consider the cartesian coordinate system -- arguably one of the most brilliant and important ideas in the history of science -- which seems totally obvious today, and which is now taught to children in elementary school.
That's a handful by itself. Not to mention the ancillary stuff like hashing,
Hashing is a technique all programmers are already familiar with. Moreover, the hash tables used in conventional chess programs are particularly simple (fixed size, very simple hashing function). Again, this is of course because of the work done by others. Inventing the idea of Zobrist hashing is hard, but understanding and implementing it is extremely simple.
extensions and reductions,
Extend checks and use recursive null move pruning, and you already have a very fast and efficient search, with very little effort.
how/what to evaluate, etc.
This is more about chess knowledge than about programming knowledge. It would be hard work for someone who doesn't know anything about chess, but such people probably wouldn't be interested in writing a chess program in the first place.
And while I don't think chess is an impossibly difficult task, for a first-timer it is most certainly non-trivial.
It is non-trivial, but no more than moderately difficult (assuming that the goal is to write a master-strength program, and not to win the world championships).
So for me, writing a program from scratch is an easy task. But I've only been doing this for just a hair over 40 years now so it should be.
Yes, but because you have generously shared the knowledge you have obtained through your 40 years of experience, the younger generation can learn everything in a tiny fraction of the time.
But starting from scratch, with no alpha/beta/minimax experience of any kind, this is not for the casual one hour a week programmer.
I have always been a casual one hour a week programmer, and I am fairly sure most other amateur chess programmers also are.
Tord