Arimaa Forum (http://arimaa.com/arimaa/forum/cgi/YaBB.cgi)
Arimaa >> Bot Development >> Sample non-bitboard bot in C
(Message started by: unic on May 26th, 2006, 1:21pm)

Title: Sample non-bitboard bot in C
Post by unic on May 26th, 2006, 1:21pm
Hello,

in chat the other day, I said I'd put up a simple non-bitboard bot in C... and so I have now.  It can be found at http://www.df.lth.se/~unic/fairy.zip.

Included in this archive are three different versions - one light (most search techniques stripped out, stupid evaluation), one medium (search almost as in full fairy, stupid evaluation), and one full (the full version of fairy).

People: feel free to do whatever you would like with these.  If you want to see how a basic alpha-beta with move-generation and updating the board is done, look at the light version.  If you want to see how killer-moves, etc., can be added, look at the medium version.  If you want to work on your own bot, but are only interested in working on eval, take all the code from the medium version and replace the eval with your own eval.  If you want to modify and improve fairy (or just run a clone of it), use the full version.  No strings attached, no license.  (Of course, my copy of fairy will keep evolving and changing... so the full fairy in that zip archive will soon not be the same as the full fairy I have.)

Note 1 - light version is limited to a fixed depth of 8 steps, which can be changed in source code.  medium and full use 2 minutes.
Note 2 - all these were developed and compiled using Dev-C++ and the MinGW distribution of gcc under Windows.  I have no clue if they compile without trouble on other compilers or OS.

Omar: If you want to put this (or parts of it) up on the download page, feel free to do so.

If anybody have questions, please feel free to ask them here.

Title: Re: Sample non-bitboard bot in C
Post by Fritzlein on May 26th, 2006, 3:51pm
Well, that answers my question about how to convince you to enter Fairy into the Comptuer Championship.  With the code all public I only need to convince someone to port it to Linux for you.  Thanks!   :-)

Title: Re: Sample non-bitboard bot in C
Post by Swynndla on May 26th, 2006, 4:17pm
This is very nice of you Unic ... and great for the arimaa community ... thanks!!

Title: Re: Sample non-bitboard bot in C
Post by Swynndla on May 26th, 2006, 4:41pm
And it works fine! ... in linux I compiled it via:
gcc -static -g -O4 board.c getMove.c search.c eval.c hash.c -o Fairy

... and it compiles just fine (this is the syntax used to compile the C Sample bot).

I ran it with:
./Fairy mytest.positionFile

(where mytest.positionFile contains a position in the forum according to the bot interface kit readme)

and it runs  just fine! ... gives it's running analysis and then spits out it's move!

I know C is portable, but I didn't realize that it'd be this easy!  :o

Title: Re: Sample non-bitboard bot in C
Post by aaaa on May 26th, 2006, 5:05pm
There is no -O4. -O3 is the maximum and is what everything above it gets turned into.

Title: Re: Sample non-bitboard bot in C
Post by nbarriga on May 27th, 2006, 7:39pm
I get 2 errors compiling Fairy_full:
eval.c:21: error: static declaration of ‘direction’ follows non-static declaration
board.h:168: error: previous declaration of ‘direction’ was here

The other 2 compile well.

Title: Re: Sample non-bitboard bot in C
Post by unic on May 27th, 2006, 7:55pm
Just remove that line from eval.c, and it should work - both board.c and eval.c define direction[] to be the same thing... having it defined in eval.c is a left-over.  (And as my compiler didn't spit at it, I hadn't noticed...)

Title: Re: Sample non-bitboard bot in C
Post by omar on Jun 5th, 2006, 12:21am
Thanks a lot for contributing this bot Ola. I have added it to the downloads page.



Arimaa Forum » Powered by YaBB 1 Gold - SP 1.3.1!
YaBB © 2000-2003. All Rights Reserved.