                           Introduction

This is the readme file accompanying the source code for the chess
playing engine Glaurung.  It contains licensing information and a
brief description of the contents of each source file.


                             License

You are free to use and modify Glaurung's source code in any way you
want as long as you do not share the resulting program with others, and
you do not enter computer chess tournaments with the program.  If you
want to redistribute the program or participate in tournaments, you
must observe the following rules:

1. The program must be accompanied by a readme file explaining that
   the source code is based on Glaurung.  If you run the program on a
   chess server, the finger notes must indicate that the program is
   based on Glaurung.

2. You are not allowed to sell any program based on Glaurung without
   explicit permission from me (Tord Romstad).


                        A guide to the source code

Glaurung is written in plain C.  The source is currently optimized for
readability, brevity and flexibility rather than for speed.  I hope
that the code will be easy to understand by anyone who knows the C
programming language and is familiar with the basics of chess
programming.  The source code consists of the following files:

glaurung.h: Declarations of global constants, macros, types, functions
and variables

attacks.c: Functions for computing attacks, checks, and finding pinned
pieces.  

board.c: Functions for initializing the board and the piece lists.

data.c: Global variables.

endgame.c: Special evaluation functions for basic endgames.

eval.c: The main static evaluation function and related functions.

extend.c: Handling of search extensions.

history.c: History heuristic code.

init.c: Functions for initializing the engine and its data structures.

io.c: Input and output functions not directly related to the UCI
interface. 

main.c: The main() function.

mersenne.c: Mersenne twister random number generator.

move.c: Functions for making and unmaking moves, for checking move
legality, and various other simple functions related to chess moves.

movegen.c: Functions for generating moves, captures, checks, and check
evasions. 

order.c: Move ordering code.

pick.c: The pick_move() function, which picks the highest valued move
from an ordered move list.

psq.c: Piece square tables.

pstruct.c: Pawn structure evaluation and pawn hash table code.

root.c: The root search function.

search.c: Contains the main search and quiescence search, and various
related functions.

see.c: The static exchange evaluator.

think.c: The think() function, which starts a new search from the
root.

tt.c: Transposition table code.

uci.c: UCI compatibility code.

zobrist.c: Zobrist hashing.


When trying to understand how the program works, it is probably best
to begin by looking at the think(), root_search(), search() and
qsearch() functions, while having the glaurung.h file as a reference
for constants and type definitions.


