|
|
|
How NagaSkaki
plays chess Part 1: The early years My first attempt at writing a chess engine was at the age of 15 (or something close to that.) After finishing a program that could play noughts and crosses, I thought it was time for something more challenging - of course chess seemed like a nice challenge and I immediately accepted! Now the only computer language I knew back then was Basic (GW Basic, Quick Basic and Turbo Basic comes to mind) and Pascal. Of course Basic is not for real programmers, so I chose Pascal. The fact that my Pascal tutor at that time (Mastering Turbo Pascal 6.0 by Tom Swan - an excellent book) had an example of how to represent a chess board might also have helped with my decision. Anyway, except for that little piece of information I had no knowledge of how to do the rest of the programming (I don't think I've even heard of the Internet at that time!) The computer on which I programmed my masterpiece was an 80286 with a hefty 40Mb hard drive and 1024Kb of RAM - a real monster when we bought it a few years ago. I started programming at a feverishly fast pace and before long I had a program that knew the basic moves of all the pieces (of course things like castling and "en passant" captures would only be added later.) I then started with the search algorithm. It never occurred to me that a function could call itself, thus I wrote a different function for every ply of search. If I remember correctly the first attempt searched three or four plies deep. I remember very well the first time I compiled my program and pressed the play button (OK, so it wasn't really a play button, more like pressing enter at a command prompt.) I waited in excitement for the first move of my masterpiece! And waited.... and waited... and waited.... finally, just as I was about to press the ctrl-alt-del sequence it moved! And what a stupid move it was! Something like knight to h3 or perhaps even an illegal move. Well, I wasn't about to give up that easily so I kept on programming for a few more days or weeks until I created something that I've never been able to do before: a program that resets your PC as soon as you run it! For me it was a sign that I should start wasting my time on something else. And that was how my first chess attempt abruptly came to halt.
|
© 2008 Mayothi