Your first chess program.

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

Joost Buijs
Posts: 1564
Joined: Thu Jul 16, 2009 10:47 am
Location: Almere, The Netherlands

Re: Your first chess program.

Post by Joost Buijs »

My first chess program was written during the end of 1977 in assembler for the Heatkit H8 (2MHz. 8080) and played it's first moves in januari 1978.
I don't remember much details, only that the move generator was able to generate 15k moves/sec. (rather fast for the hardware used). With full evaluation the program searched about 700 nodes/sec. The search depth was around 3 to 4 ply including quiescense. The playing strenght was approx. 1600 Dutch ELO.
User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: Your first chess program.

Post by Evert »

Over summer holidays in 1992 or 1993 I wrote my first chess program in 8086 assembly language in a notebook. Then when I got home I implemented the thing (using inline assembly in Turbo Pascal).
I think I only had material evaluation and maybe piece square tables and no quiescence search. I discovered much later that there was a bug in the move generator caused by ignoring the piece type when setting the en-passant square, leading to hilarious results like 1. ... Qd7-d5 2. e5xd6ep
jdart
Posts: 4367
Joined: Fri Mar 10, 2006 5:23 am
Location: http://www.arasanchess.org

Re: Your first chess program.

Post by jdart »

I wrote a DOS-based program in Modula-2 back in 1991-2. It was never released. It had an integrated user interface written in assembly language, using direct video writes, supporting VGA and Hercules graphics modes (if you remember Hercules, you are an old-timer like me). The graphics was probably the best part of it, though, because the chess engine was junk, and like Dan, I was happy if it could solve mate in 4 or something like that. It tried to do some fancy dynamic eval with analysis of en prise pieces etc. - sort of like an eval function with integrated SEE. I'm ashamed to even show the code to this, although I still have the source.

Arasan was started from scratch some time later (1992?) and was C++, and more or less a conventional alpha-beta searcher with a hash table and null move, although I probably did lots of things wrong in my first implementation of this. Also it used Windows for UI (then a very new technology).

--Jon
Harald
Posts: 318
Joined: Thu Mar 09, 2006 1:07 am

Re: Your first chess program.

Post by Harald »

I wrote my first chess program "HLSchach" 1990 on the Atari ST.
It had a nice GEM GUI but the engine was poor and slow.
It was never released.

- The static evaluation was ok
- Alpha-beta search without any tricks
- No hash table
- Poor move ordering, but I tried to dynamically sort good moves to the top.
- The move generator kind of selected valid moves from the sorted list.
- Coded in C and German with a little English

Is anybody interested in the code? The zipped folder includes some pictures
and binaries and has about 400 kByte. Uncompressed source about 300 kByte.

Harald
F. Bluemers
Posts: 868
Joined: Thu Mar 09, 2006 11:21 pm
Location: Nederland

Re: Your first chess program.

Post by F. Bluemers »

Harald wrote:I wrote my first chess program "HLSchach" 1990 on the Atari ST.
It had a nice GEM GUI but the engine was poor and slow.
It was never released.

- The static evaluation was ok
- Alpha-beta search without any tricks
- No hash table
- Poor move ordering, but I tried to dynamically sort good moves to the top.
- The move generator kind of selected valid moves from the sorted list.
- Coded in C and German with a little English

Is anybody interested in the code? The zipped folder includes some pictures
and binaries and has about 400 kByte. Uncompressed source about 300 kByte.

Harald
ah,Atari ST :D I had one too
You used metacomco C too?
I once ported the basic code from "Das grosse ComputerschachBuch" to C on the Atari.
Data Becker had some real good books those days...
mjlef
Posts: 1494
Joined: Thu Mar 30, 2006 2:08 pm

Re: Your first chess program.

Post by mjlef »

I took used an Ohio Scientific (C1P I think). It had a "massive" 4k bytes, and I wrote a chess program in interpreted BASIC for it. This was about 1980. When I had a co-op job during a break in college for GE, a boss there gave me some used memory chips allowing me to upgrade it to 8k! Wow! To fit the program I had to use direct peek and poke statements (to allow byte access since and INT would be too big!). And you had to put multiple lines together since breaking them up took too much memory. Even spaces took up memory so it was all squashed together. It only did 3-4 ply searches. I remember after a long drive on icy roads, a chess playing friend, very tired from the drive, agreed to play it. And for the first time, my program won a game!
User avatar
Don
Posts: 5106
Joined: Tue Apr 29, 2008 4:27 pm

Re: Your first chess program.

Post by Don »

mjlef wrote:I took used an Ohio Scientific (C1P I think). It had a "massive" 4k bytes, and I wrote a chess program in interpreted BASIC for it. This was about 1980. When I had a co-op job during a break in college for GE, a boss there gave me some used memory chips allowing me to upgrade it to 8k! Wow! To fit the program I had to use direct peek and poke statements (to allow byte access since and INT would be too big!). And you had to put multiple lines together since breaking them up took too much memory. Even spaces took up memory so it was all squashed together. It only did 3-4 ply searches. I remember after a long drive on icy roads, a chess playing friend, very tired from the drive, agreed to play it. And for the first time, my program won a game!
I tried a couple of time to write a chess program in basic, but did not succeed due to the small memory size of the TRS-80 I had which was 4k. The program as well as all data had to fit in 4k. I don't even know if that was even possible to do in Basic, but it was definitely not possible for my skill level at the time. 4k was the entire RAM in the machine and some of this was needed for the operating system (which was essentially the basic interpreter.)
Capital punishment would be more effective as a preventive measure if it were administered prior to the crime.
User avatar
jshriver
Posts: 1342
Joined: Wed Mar 08, 2006 9:41 pm
Location: Morgantown, WV, USA

Re: Your first chess program.

Post by jshriver »

My first program is almost chess lore. I started the obsession around 1996 and have yet to finish. Think at that time I was using a P133mhz system with 8 megs of ram, running Slackware.

Caught the chess bug in high school, and AI fascinated me. When I entered college that fall I came across crafty and I was hooked. Figured it would be a nice test bed for learning about AI systems and started reading. Talkchess has always been a great home for tossing ideas and have been following it since early on.

Still working on olympus, and have started from scratch at least a dozen times. Each time creating cleaner and more efficient code as my programming skills were getting better.

I've spawned a handful of side projects all with hopes of incorporating them into my engine. Namely my "Golden Tree" project which has had solid code for several years now. However the goal of the project has changed since I no longer want to record the best moves based on engine-X (started with crafty, then fruit, then Rybka) as I realised the database would corrupt the purity of my engine. Since it would be their moves it would play not my own so I stopped dedicating CPU time to it, and have let the code go idle till my engine is done. Then plan to start fresh and let my engine crunch away using the Golden Tree framework.

For a while even veared toward genetic algorithms and still plan to use some of that code for seed values in my evaluation function but no longer a driving force. Have also done some minor code first using GPGPU's then as it became more common CUDA and now OpenCL. But alas it was a dead end.

Have also been a big fan of egtb's. Though I no longer aspire to write my own I was lucky enough to get permission from both authors to use Nalimov code in my engine, but also plan support Gaviota as I respect that project as well. Have stable probing code with glue written so that will be a nice bump once the rest is done.

It's a wonderful field. I'm also interested in Go and have been following it a couple years as well via the comp-go mailing list. That engine is very dumbed down but oddly was able to get a working/playable version done even though my chess engine isn't complete.

My dream is to go to the WCCC in person someday and let my brain child play. Meeting fellow comp-chess enthusiast in person is another dream. Never been to Europe or Asia so it's something to look forward to.
User avatar
jshriver
Posts: 1342
Joined: Wed Mar 08, 2006 9:41 pm
Location: Morgantown, WV, USA

Re: Your first chess program.

Post by jshriver »

mar wrote: In case someone wants to see cheng1 in action and laugh, here's the link (Windows only).
http://www.mediafire.com/?fwqj59mzk14vv92
Thanks for sharing :) I had fun playing it.
kinderchocolate
Posts: 454
Joined: Mon Nov 01, 2010 6:55 am
Full name: Ted Wong

Re: Your first chess program.

Post by kinderchocolate »

Sounds like everybody here had an engine before I was born. My first chess engine starts in 2012.