readme file for Horizon 4.4 chess engine



                    Altering Horizon's Configuration File

               by Ron Murawski (email: HorizonChess@yahoo.com)

The proper way to adjust some fundamental Horizon options is altering the file
"Horizon.cfg". Use a text editor such as NotePad to change this file and
customize it for your own use. The default values mentioned are used in case
the item might be missing from the configuration file or set to an out-of-range
value or misspelled. The easiest way to verify your current configuration is
to double-click on 'Horizon.exe' in Explorer. It will list the current
settings. Then type 'quit' to quit the Horizon program.



                         HASH - Main Hash Table Size

A hash table is a portion of memory where previously evaluated positions are
stored. Chess engines use this table to avoid re-calculating already-scored
positions. Hash table size should be adjusted to suit the speed of your
computer and the time control you play. The often quoted formula to set a
hash table size (in KB) is twice your processor speed (in MHz) times the
average time to move (in seconds).

Here are a couple of examples:

1) 2.1 GHz processor playing at 40 moves in 15 minutes. Average move time =
(15 minutes * 60 seconds / 40 moves) = 20 seconds per move. The hash should be
set to (2100 x 2 x 20)K = 84,000K = 84MB.

2) 1.2 MHz computer playing 5 minute Blitz. Let's assume a typical computer
game is 66 moves, so average move time = (5 minutes * 60 seconds / 66) = 4.5
seconds per move approximately. A good hash size would be (1200 x 2 x 4.5)K =
10800K = 10.8 MB. For this example, setting the hash to 11 MB is fine.

3) A 1.4 MHz computer playing game in 5 minutes plus an increment of 3 seconds
per move is tougher to calculate. Assuming that an average game will last 66
moves, there will be an additional 3 seconds per move compared to example 2
shown above. So the average move time = (4.5 seconds + 3 seconds) = 7.5 seconds
per move. The hash size should be set to (1400 x 2 x 7.5)K = 21000K = 21MB.

I have found through experimentation that setting Horizon's hash size to
larger than the above calculated values strengthens its play. My estimation
for strongest play is 1.5 times the calculated amount. For the above
calculated examples I would use 126 MB, 16 MB and 32 MB respectively. Setting
a hash too big won't hurt at all. On the other hand, using a too-small hash
table will almost always hurt performance.

The following line causes Horizon to use a hash table size of 57 MB (where HASH
means 'hash table size')

HASH 57

Hash settings can be set from 1 MB to 256 MB. The default size is 64 MB.


                      PAWN_HASH - Pawn Hash Table Size

A pawn hash table is a portion of memory where previously evaluated pawn
positions are stored. Chess engines uses this table to avoid re-calculating
already-scored pawn positions. This table is useful more than 99% of the time.
It is important to make this table large enough, but there is no advantage to
making it overly large. I have found that the pawn hash gains nothing from
increasing its size beyond 4 MB. No testing has been conducted to determine
the smallest size that does not weaken game play.

The following line causes Horizon to use a pawn hash table size of 4 MB (where
PAWN_HASH means 'pawn hash table size')

PAWN_HASH 4

Pawn hash settings can be set from 1 MB to 32 MB. The default size is 4 MB.


                  TB_DIRECTORY - Endgame Tablebase Location

Horizon can use Eugene Nalimov's tablebase files. The files can be downloaded
from Bob Hyatt's ftp site: ftp://ftp.cis.uab.edu/pub/hyatt/TB Using tablebase
files allows a chess program to play perfectly when material matches the
endgame files you have downloaded. Please note: it is very important to have
all the three-piece tablebase files before downloading any of the fours,
because these files plug into one another and a missing file can cause
puzzling and weak endgame behavior by a chess engine.

The following line tells Horizon the directory location of tablebase files.
(where TB_DIRECTORY means 'tablebase directory'.)

TB_DIRECTORY C:\Chess\Nalimov


                      OPENING_BOOK - Opening Book File

Horizon uses an opening book to help it play more strongly. An opening book is
a list of equal or advantageous positions that can be reached early in the
game. Horizon's original book was designed by Jim Monaghan. An improved book
is available along with each new engine release. Additionally there is always
a 'beta book' always available for download at
http://horizonchess/Files/BetaBook.7z
It is updated about once every month or two but may remain unchanged for
longer periods. The update schedule depends on my free time. The beta book is
*always* the latest version of the book. The opening book has been modified so
that it takes advantage of Horizon's unique strengths while avoiding its
weaknesses. I have spent countless hours improving this book. Replacing this
book with a so-called 'neutral book' will alter playing strength producing
inaccurate and distorted results.

The following line tells Horizon the directory location and the name of its
opening book. (where OPENING_BOOK means 'opening book')

OPENING_BOOK C:\Chess\Engines\Horizon.dat


                 BOOK_STYLE - Playing Style of Opening Book

There are 4 possible opening book playing styles: WIDE, TOURNEY, BEST, and
DEEP.

The default setting is BOOK_STYLE WIDE, which randomly chooses opening book
moves according to the frequency which they were played in the pgn games that
were used to build the book. This has been the book style that Horizon has
used historically. TOURNEY avoids least-played book moves. DEEP plays deepest
book lines (most popular ones). BEST plays 'best' book moves -- BEST is a work
in progress and is probably the weakest option. Styles other than BOOK_STYLE
WIDE choose from a subset of the entire book.

You can specify a number following any book style choice. In the case of
BOOK_STYLE WIDE this number is ignored. The possible range for this number is
1 to 9. The default value is 9.

Examples:
  BOOK_STYLE DEEP 3   : chooses between 3 most commonly played book moves
  BOOK_STYLE BEST 2   : chooses between 2 'best' moves
  BOOK_STYLE TOURNEY 1: occasionally chooses some unusual moves
  BOOK_STYLE TOURNEY 5: chooses moderately reputable moves
  BOOK_STYLE TOURNEY 9: avoids all rarely-played book moves

Notes:
  DEEP 9, BEST 9, and WIDE are identical options.
  TOURNEY 1 and WIDE are similar, but not identical

The strongest opening book playing style is unknown. My guess is that WIDE, or
DEEP 3, or TOURNEY 5 might be the strongest. I would be interested in results
from any tester who plays many games using the various book style settings
against the same set of opponents.


                  EGTB_CACHE - Endgame Tablebase Cache Size

The Endgame tablebase cache size is adjustable. In general a very large egtb
cache will take more time to fill (with potentially useful information), so
initial egtb probes will be slower. But later probes will be faster because
more information is stored. I have no idea what an ideal size might be.

The following line sets the egtb cache size to 4MB

EGTB_CACHE 4

Egtb cache settings can be set from 1 MB to 32 MB. The default size is 2 MB.


                            RESIGN - Resignation

It has been reported that there are problems using Horizon under the Fritz GUI.
It was suggested that turning resignation off would solve this problem so this
feature has been added. There is no reason to use this option if playing under
WinBoard or Arena.

The following line turns resignation off (default is ON)

RESIGN OFF


                          ICS - Enable On-Line Play

This option can be turned on or off. The defult setting is off. ICS stands for
Internet Chess Server.

The following line enables ICS play:

ICS KIBITZ

It kibitzes (sends) the pv (principle variation, or the engine's calculated
sequence of best moves for each side) along with the current score to the ICS
server.

The following line disables ICS play (default value):

ICS OFF


                           SET_ELO - Elo Weakening

If you find Horizon to be too strong of an opponent, you can weaken its play
by specifying a lowered Elo level. You can reduce the normal playing strength
until Horizon plays at the level you desire. There has been no validation
testing concerning the accuracy of the Elo settings. If anyone ever does this,
please email me and I will add the information here. Keep in mind that Elo
weakening is achieved by wasting time in an idle loop: because of the enforced
idleness, the response to user commands can be quite sluggish. It should be
noted that weaker Elo levels fetch proportionately fewer moves from the
opening book than stronger ones. The lowest possible setting will fetch no
book moves at all.

The following line sets Elo strength to 1367

SET_ELO 1367

Elo settings can be set from 1000 to full-strength. The default strength is
full-strength. The configuration file will always indicate the current
version's assumed Elo at full strength.


            DISABLE - Disable Search Options to Weaken Chess Play

Search options can be selectively disabled. A human player can use this option
to increase his winning chances.

The following is the full list of search options that can be disabled:

 NULL         : disables null move search and null verify search
 NULL_VERIFY  : disables null verify search only (null move search unaffected)
 CHECK_EXTEND : disables check extensions to the search
 RAZOR_CUTS   : disable razor cuts from the search (unfruitful lines)
 DELTA_CUTS   : disable delta cuts from the search (lines w/ material loss)
 IID          : disable internal iterative deepening search

Options can appear in any order and in any combination. Disabling null-move
and check extensions probably weakens play the most.

Examples:

DISABLE NULL IID
   disables: null move (*and* null verification search!) and IID search
DISABLE DELTA_CUTS NULL_VERIFY
   disables delta cuts, and null verification search (but *not* null move)
DISABLE CHECK_EXTEND NULL
   disables: null move (*and* null verification search!) and check extensions
DISABLE NOTHING
   play at full strength

The default value is DISABLE NOTHING (play at full strength).


                            Opening Book Learning

NOTE: Learning has *not* been implemented. This section contains ideas that
may benefit Horizon some day.

This is the most complex configuration command. It is designed to improve the
opening book. It might be helpful to imagine the book layout: it is composed
of a position followed by a series of what the engine believes to be good
moves for that position. Each of these moves has a tally of how many times it
was played. During a game moves get selected from the opening book according
to how often they were played in games already learned.

The LEARN command contains 2 parts. The first is the LEARN argument.

'LEARN 0'  means do *not* learn, do *not* change the opening book (default)
'LEARN +'  means learn from wins only by encouraging the game moves
'LEARN -'  means learn from losses only by discouraging the game moves
'LEARN =+' means learn from drawn games by encouraging the game moves
'LEARN =-' means learn from drawn games by discouraging the game moves
'LEARN $'  means learn from all decisive games (not from draws)
'LEARN *+' means learn from *all* games, rewarding drawn games
'LEARN *-' means learn from *all* games, penalizing drawn games

If the engine wins a game and is configured to learn from that, all existing
book moves that the engine played during the game get incremented -- it will
become slightly more likely for these moves to be selected in a future game.
'Slightly more likely' will change the probability percentages of early moves
very little -- those near the end will change the most. It takes many
thousands of games before move probability changes are noticed. Also the first
move that the computer had to calculate *might* get added to the book as well.
(See explanation further below.)

If the engine loses a game and is configured to learn from it, all existing
book moves get decremented so that it will become slightly less likely for
these moves to be selected in a future game. If a move gets decremented down
to zero, it effectively is removed from the book.

If the engine draws a game and is configured to learn by rewarding that
result, all existing book moves played by the engine during the game get
incremented so that it will become slightly more likely for these moves to be
selected in a future game.

An invisible part of learning is: if the engine is learning a won game, then
it is possible that one completely new position with associated move will get
added to the book. If added, the new position will be the first position where
the engine had to calculate its move. New moves are added if the last book move
was played 4 or more times.

There must be a way to limit adding completely new moves because over a long
period of time the book will get too large and too deep. This is what the
third option is for. A MAXBOOK setting will refuse to add any new moves beyond
the ply depth specified. The default MAXBOOK value is 40. It is possible to
add moves up to castling for the learning side by specifying soething like:
MAXBOOK 40 O-O. If O-O is specified and the learning side did not castle, then
MAXDEPTH reverts to the default value of 40, otherwise the book is allowed to
extend up to the learning side's castling move.

Both LEARN settings must be on the same line. Here are some examples:
LEARN + MAXBOOK 30
Learn from engine wins only (+), add new moves to the book to a maximum depth
of 15 moves (30 half-moves). This will make past successful moves more likely
to be played in the future.

LEARN - MAXBOOK 30
Learn from engine losses only (-). The MAXBOOK option is meaningless because no
new moves will be added. This will make past unsuccessful moves less likely to
be played in the future.

LEARN =+ MAXBOOK 40 O-O
Learn from draws only by rewarding them (=+) and limit book depth up to
whenever castling occurred, or 40 moves if it did not occur. This will make
the book more drawish. If the opposing engine is stronger, then this option
should strengthen the book.

LEARN =- MAXBOOK 40
Learn from draws only by penalizing them (=-) and limit total book depth to 40
plies (20 full moves). This will make the book less drawish. If the opposing
engine is weaker, then this option should strengthen the book.

LEARN $ MAXBOOK 18
Learn from all decisive games ($), and limit total book depth for new moves to
18 plies (9 full moves). This make past successful moves more likely to be
played and past unsuccessful moves less likely to be played in the future.

LEARN *+ MAXBOOK 24
Learn from all games rewarding draws (*+), and limit total book depth to 24
plies (12 full moves). This will make the book more drawish. If
the opposing engine is stronger, then this option should strengthen the book.

LEARN *- MAXBOOK 24
Learn from all games penalizing draws (*-) and limit total book depth to 24
plies (12 full moves). This will make the book less drawish. If the opposing
engine is weaker, then this option should strengthen the book.

I intend to play against almost equal opponents and use:
LEARN $ MAXBOOK 40 O-O
I'm attemptimng to squeeze out lost opening lines (leading to positions which
the engine doesn't seem to understand) and encourage winning lines (which the
engine *does* seem to understand). Because draws are ignored I'm hoping that
they will slowly get squeezed out too, making for more interesting games.

It must be stressed that not all learning is beneficial. If Horizon is paired
against an extremely strong opponent then learning lost games over a long
period will just reduce the size of the opening book without strengthening it
as game after game is lost. Similarly if Horizon is playing extremely weak
opposition and learning won games, then many moves will get added to the book,
some of which will certainly be bad. The success ratio against an opposing
engine should be close to 50% (perhaps 45% to 55%) for learning to have
guaranteed beneficial effects. Outside of those limits you can only reward
wins and draws against stronger opponents and penalize draws and losses
against weaker foes.

It is *not* recommended to use learning during tournament play. Learning
cannot affect the opening book's quality in any meaningful way unless several
thousand games are played and correct options are chosen throughout the
process.


Ron Murawski  --  HorizonChess@yahoo.com
