MiniChessAI                                written by: Marcin Gardyjan

First- sorry if there are any mistakes in my engish.

This is a chess engine compatible with CECP protocol (chess engine
communication protocol), it is a protocol wich support XBoard, WinBoard,
or the latest ChessMaster 8000/9000.
Chess engine means computer AI, without graphic interface. You can play
in a text mode, but this is a litlle not comfortable. I recommended to
use interface provided with this chess ("Simple Chess") engine or to
download Winboard (for Windows) or XBoard (for Linux) interface, wich
are fully free and avalible on many servers like eg:

http://www.tim-mann.org

My engine support additional instructions wich aren't in CECP protocol, but
later about it.

    MiniChessAI it is my second engine. It is designed to play with people and
CECP support (chess engine protocol wich engines compatible with this protocol
can play together by any graphic interface compatible with this protocol, also
you can use any graphic interface wich is compatible with this protocol). Maybe
in a time game my engine will lose vs good chess engines, but its speed is
enought to play with people. The level can be set from so easy that it is
optimal rival for the man who is learning chess to play so hard so it is well
partner to good player (but not master player). Level can be limited by time,
depth (number of moves predict), time and depth, or number of situations
predict. It can play with four profiles (calm, normal, aggressive, mixed).
    Idea of algorithm bases only on a certain techniques (like sorting by
stronger moves, hash tables or killer moves), there are no cutting tree
techniques wich bases on a propability of succes (like nullmove, or razoring)
where computer plays usualny faster/better but sometimes make tactical
mistakes. Playing on a teoretical infinity fast machine (or a machine wich
can calculate all giand chess tree in a good time) my algorithm will always
chose best possible move*.

*Offcourse if I set more memory for one of arrays in a program to a number
enought to predict all game.

If someone wants to my engine play better in game on time he can increase
master's book or buy faster processor.

Engine can play with time limit or/and depth limit. It can play in four
profiles: calm, normal, aggresive, mixed.

Engine Speed: about 80000 nodes on Athlon 1.4Ghz

For first move on Athlon 1.4Ghz
depth 5+ (quiescentsearch) finished in 0.35s
depth 6+ (quiescentsearch) finished in 2.85s

*quiescentsearch is a idea of deepening tree in leafs if there are not
complete takes action.

This version support only one procesor but in future I going to do
multiprocessor version.


Files:
minichessai.exe       - main program
minichessai.ini       - configuration file (description later)
minichessai.txt       - file with manual while you are reading now
minichessai.log       - log (part 1)
minichessai.log2      - log (part 2)
miniailastgame.pgn    - save of last game
minichessaimaster.book- the file with master's games (more games means
                        better play in time game)

miniailastgame.pgn    - this file is a save game in XBoarda standard. You can
                        transform this file to be compatible with minichessai
                        cutting a fragment of file- manual in this file.


Master's Book:

minichessaimaster.book

Can work in two modes:

usebook off

Book works as a tank for hash tables. Computer will think faster, but it
will be decide about a move.

usebook on

When game follow by the other known game of Mastets and computer is in
a winer side it follow by this game.

If someday happen that MiniChessAI on a very fast computer play better
than some master player from book, book should be off or erase some
master players that are weeker.


INI file:
We can set minichessai.ini and put to it commands wich will be read and
execute automaticly while engine starts, so we don't have to allways
configurate the engine.

Difficulty level:

Default the difficulty level is set to 5 minutes game for computer without
depth limit. We can set a time or/and depth limit or number of situations
predict to make computer plays worse or better.

Advantage of depth limit is that on every computer computer will play
at thesasame level. It is important for weeker players, when in time limit
computer play to good. Disadvantages is that computer plays less like human
and in the end of a game when there is not much situations to calculate we
though that computer play worse because human in the end of game think mode
deep and sometimes we see without problem thinks that computer have
to calculate deep tree. When we play with time limit the problem is not exist
because computer then thinks deeper when there are less situations on a board.
We can also limit computer in difrent way- number of situations predict.
Computer will play in thesame level no matter how fast machine we have,
and in the ends of game it will play more like human because if situation
is simpler it will predict deeper. Of course two diffrent engines wich would
be play with this limit don't have to play in thesame strongest. It is good
level for week or medium players.

Better players should play with time limit when game is more interesting
and harder, but weaker players should try to play with depth limit, or
with very short time limit or with number of situation predict limit.
The high limit of depth is 37 moves- I think it is enough, but if you have't
super fast processor don't try to set to high number of depth without time
limit, because you will not survive the moment when computer makes a move.

Here is the examples of depth limit set:

levelmode depth
depth 4

levelmode nodes
nodes 100000

will cause that computer will not predict more than 100000 situations.


will cause that computer will don't predict more than 4 moves ahead.
The levelmode is describe later.

depth 4

will cause that to the default time limit we will have also depth limit
to 4 moves. The idea is that if the one limit is set setting the another
we don't change the previous one (except number of situation limit)!
Exept we use levelmode command:
levelmode time       - computer is limited only by time
levelmode depth      - computer is limited only by depth
levelmode depth&time - computer is limited by time and depth
levelmode nodes      - computer is limited only by number of situations predict

Other example:

level 0 0:30 0

spowoduje zmiane ograniczenia czasu komputera na 30 sekundowa na gre.
Im wiekszy czas i im szybszy komputer i im mniej sytuacji na szachownicy do
rozpatrzenia (np pod koniec gry) tym komputer lepiej bedzie gral.

will cause change time limit to 30 seconds per game.
More time you will give and faster hardware you have and less situations
on a board to calculate means better computer play.

level 0 5 10

will cause set time 5 minutes for computer for game and 10 second time
increase per move.

level 10 2 0

will cause that every 10 moves computer clock will increase 2 minutes.
Other example:

depth 5
level 0 8 0

will cause computer time limit set to 8 minutes and depth limit set to
5 moves predict ahead.

Also we can add:

quiescentsearch on

will cause turn on quiescentsearch algorithm. This algorithm give that computer
can predict all complecated takes action, but sometimes it can think
strategicly less deep in time game. But it plays MUCH BETER when its turn on.
In game with clocks off it can think much longer, but much better.

We don't have to allways write it.
We can set ini file wich we can put all commands wich will be automaticle
read and execute when engine starts.

Because we usualy play in graphic interface not in text mode, but in fact that
graphic interface sets its own settings we can protect using:

levellock on

wich will cause that next commands about difficulty level and computer game
style will be ignored.


We can also set computer profile:

emotion calm       - calm, tactical
emotion normal     - betwen
emotion aggressive - agresive, impatient
emotion mixed      - impatient when it's winning, and tactical when it's
                     loosing.

Default is emotion mixed.

charakter (styl gry) nie wplywa na poziom trudnosci, a poniewaz na roznym
ze styli komuter gra troche inaczej to jest przyjemniej grac z komputerem
ktory gra roznymi stylami.
Roznica w stylu gry calm, a aggressive jest znaczna.
Mozemy tez wpisac:

Profile (game style) don't infuante on a difficulty level. In fact that in
every profile computer plays litlle diferent that it is more pleasure
to play. Much diference is betwen calm style and aggresive.

emotionrandom on

Will cause when we set new game that profile will be random.
Or:

emotionrandom on
new

That cause start new game with random profile.

When we wants that computer play at active site we write:
go
Eg. we want that computer plays white so at start we write "go".


Pre-intermidiate player predict about 4 moves ahead.
This is few difficulty sets examples:

The realy begginer set:

levelmode depth
depth 1
levellock on

The novice player set:

levelmode depth
depth 2
levellock on

The pre-intermidiate player set:

levelmode depth
depth 4
levellock on

Interesting set is also:

levelmode depth
quiescentsearch on
depth 1

or little better:

levelmode depth
quiescentsearch on
depth 2

or:

levelmode nodes
nodes 10000
quiescentsearch on

The advance player set (time depends at hardware)

level 0 5 0
quiescentsearch on
levellock on

The proffessional player set:

level 0 15 0
quiescentsearch on
levellock on

Sure, most of this settings can be set from graphic interface. We don't need
to set it in ini file.


TOURNAMENT OF TWO ENGINES

In case of tournament of two chess engines by graphic interface the ini file
should have only!:
quiescentsearch on
All sets all go then from interface and that is only time limits. In case
of tournament without graphic interface we have to pu time limit by using
"level" command.


Setting memory for hash tables:

sethashtable 1024

Means that 1024KB of memory will be allocated for hash tables.
More memory means faster computer play, in fact in time play it will
play better, but don't think that increasing memory two times will cause
increase speed two times. Defauld is 1024KB.
But do not set all of you Ram memory for hash tables because in
Ram there are lots of other programs wich already use it. If you
set more memory that you alredy have free may cause slow down engine.


List of commands:

new                    -new game
newgame                -new game
force                  -computer will don't move (two players mode)
reverse                -reverse board
display                -display board
loadboard FILENAME     -load board state
saveboard FILENAME     -save board state
loadgame FILENAME      -load game*
savegame FILENAME      -save game*
visualthinking on      -visual thinking
visualthinking off
sound on               -sound after computer move
sound off
xboard                 -reserved for interface (forget)
protover               -reserved for interface (forget)
levellock on           -look back (difficulty level)
levellock off
levelmode time         -look back (difficulty level)
levelmode depth
levelmode time&depth
levelmode depth&time
levelmode nodes
depth NUMBER           -look back (difficulty level)
sd NUMBER              -thesame as depth
nodes NUMBER           -look bacj (difficulty level)
level MPS BASE INC     -look back (difficulty level)
quiescentsearch on     -look back (difficulty level)
quiescentsearch off
emotion calm           -look back (difficulty level)
emotion normal
emotion aggressive
sethashtable           -look back (setting memory for hash tables
undo                   -take back one move (half turn)
takeback               -thesame as undo
remove                 -take back two moves (one turn)
hint                   -hint
xhint                  -hind generated with depth as depth limit
setboard FFEN          -set board state in FFEN notation**
go                     -computer make move (eg. we wants play white)
move MOVE              -move
MOVE                   -move
quit                   -exit engine

*- the graphic interface can have own format of save game, so if you
   saving by savegame so you have to load by loadgame, if you save by
   interface you have to load by interface.

**- eg:
    setboard rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b Kkq e4 1 1
    means a board posiotion wich we will have after e2e4 move. "b" means,
    that is a black turn. "Kkq" means, that all castlekingsides are avalible
    except short white castlekingside. "e4" means that the last pawn move was
    on "e4" position- in case that last move was't pawn move you will have
    sign "-". Next number is a number of moves from last take or pawn move
    and the last number is number of moves from the begining.


ATTENTION: All commands you have to write by using low letters (like
a,b,c not like A,B,C). Engine see diffrent betwen "a" and "A".


IF YOU FIND SOME BUGS!

Do not start new game, but save your game and send me it with
minichessai.log and minichessai.log2 files. New game will reset
log files, because log files always contain information about last
game. In mail tell me in wich move computer make a strenght move.


MINIMAL REQUIERMENT:

-PC or compatible
-Windows 32bits (95/98/Me/NT/2K/XP or better) for Windows version
-Linux for Linux version
-4MB Ram
-1MB free space on hard drive

RECOMMENDED:

-more Ram memory means better but don't forget about set hash tables
 for give program to use your potencial of Ram.
-processor with at least 64KB of cash memory and at least like P1000.
 Faster means better.
WARNING: Linux version wich limitates stack for programs: you have
to set stack limit to a minimum 1600KB, otherwise sometimes you can
see "segmantation faul" message.




                                  THANKS TO:
                      Slobodan R. Stojanovic for testing
                     Sidorowicz Grzegorz- for help i mail

                                  GREETINGS:
                              (alphabetic order)

                         Alan Stasik and his brothers
                                   Alchemik
                                     Baju
                                     Dexio
                                    Elohin
                                      Jan
                                 Jan Blinstrub
                               Jan Franckiewicz
                                Michal Byttner
                                 Pawel Kmiecik
                                Piotr Lenarcik
                                  Piotr Malek
                                Rufus Twardziel
                              Sidorowicz Grzegorz
                                 Slawomir Zak
                                     Slip
                              Tomasz Mikolajewski
                                 Tomek Oselka

                                   and you!


I am 19 years old (1983). Engine I have started to write in november 2002.
Version 1.00 I made in december 2002.
Version 1.00 it is about 2400 lines of code.

If you find some bugs please write to me!
If you watch my www you will find few nice programs there.

email: mgkiler2@poczta.onet.pl
www  : http://mgkiler.republika.pl if this adress does't work try:
       http://mgkiler2.republika.pl
