************************************************
* Mediocre v0.231b by Jonatan Pettersson        *
*                                              *
* Homepage: http://mediocrechess.blogspot.com/ *
* E-mail:   zlaire@gmail.com                   *
*                                              *
* Release date: 2007-02-26                     *
************************************************

------------
Introduction
------------

Mediocre is the result of a chess programming blog (http://mediocrechess.blogspot.com/).
In the blog every aspect added to Mediocre is described in detail as it develops.

Mediocre is written in Java and supports both the WinBoard and UCI protocols.

------------
Installation
------------

Being a Java chess engine Mediocre needs Java Runtime Environment in order to run.
It can be found on http://java.sun.com.

Note: If you do not have the path to 'java.exe' set you might have to adjust the
.bat-file to:

"C:\j2sdk1.4.2_08\bin\java" -classpath "<path to Mediocre>" Mediocre x

Where C:\j2sdk1.4.2_08\bin\ is the path to your 'java.exe'.

---------------------
WinBoard installation
---------------------

To run Mediocre in WinBoard open the winboard.ini file and find the line:

/firstChessProgramNames={GNUChess.exe
}

It might include more engines but should look something like that. Then add Mediocre
like this:

/firstChessProgramNames={GNUChess.exe
"java -classpath <path to Mediocre> Mediocre x"
}

The next time you start WinBoard you will be able to choose Mediocre in the opening dialog.

-----------------------------
Other winboard/uci interfaces
-----------------------------

In other interfaces (like Arena; http://www.playwitharena.com) choose Add Engine from
the the menus and select the mediocre.bat-file in the Mediocre folder.

New in version 0.23b: I have included the jlaunch utility in the download along with a
properties file. To run Mediocre (in any interface) simply select the jlaunch.exe as
engine. The properties file is set to run Mediocre as an UCI engine, to make it run as
winboard change the line

app.arg0=u

to

app.arg0=x

in the properties file.

This was needed to make Mediocre run in the Shredder and Chessbase interfaces.

Read more about jlaunch here; http://www.marochess.de/chess/tools/jlaunch/

-----------------
Choosing protocol
-----------------

The argument sent to Mediocre chooses what protocol to use. No argument enters a simple
line mode, 'u' uses uci and 'x' uses winboard (xboard).

For example, if you want to run the Mediocre with the UCI protocol, call it like this:

java -classpath "<path to mediocre>" Mediocre u

-------
Changes
-------

  v0.231b: * A bug in the new 'game over' check for winboard that made the engine crash was fixed
           * The transposition tables now use depth/new replacement scheme

   v0.23b: * Completely new evaluation, now accounts for king attacks, pawn evaluation and more
           * Check extension added
           * Draw repetition is now accounted for in the search tree as well
           * A bug concerning contempt factor was fixed
           * Piece lists added, no more 120 loops
           * Now gives correct mate count (and not just a high number) for both uci and winboard,
             evaluations from the transposition tables gives the count when the mate was found
             (this is on the todo-list)
           * The broken 'force' mode in winboard should now be fixed
           * Winboard protocol now sends the score when the game is finished (still needs some work)

   v0.22b: * Fixed a bug in the isAttacked method that made it do unnescessary checks
           * Changed the way unmake move works. The Board-class now has a history array where
             it keeps track of passed positions instead of using the Move-objects
           * The Board-class now keeps track of passed Zobrist keys so we do not have to
             'unmake' them when unmaking a move
           * The alphaBeta() does not generate moves at leaf nodes anymore
           * Changed ordering values for hash moves and killer moves so they always come
             first and second (at high depths the history moves sometimes came first)
           * Fixed an issue with reporting time using the UCI protocol
           * The Board-class now keeps track of king positions so we do not need to loop
             through the boardArray to find them
           * Changed move generation to use arrays instead of Vectors. generateMoves() now
             fills a given array from a certain index and returns the number of moves that
             were added
           * Alpha-beta and quiescent search now uses a common big array for storing
             generated moves instead of creating many small local arrays
           * Moves are now represented by an integer instead of a Move-object
           * The Move-class was completely rewritten and now only contains static
             methods for analyzing the new move integer
           * Fixed yet another issue with en passants (hopefully they work now)
           * The transposition table now uses an integer array instead of using Hashentry                                  objects. Many new methods for retrieving different values were added

   v0.21b: * Added support for 'infinite' search in uci (not applicable in winboard)
           * Added support for fixed time per move search for both uci and winboard
           * Added support for fixed depth search for both uci and winboard
           * Added support for the '?' (winboard) and 'stop' (uci) move-now commands,
             the 'move now' command in certain interfaces make Mediocre move immediately
           * Made null-moves only possible if the game is not in a pawn ending
           * Introduced contempt factor to draw values (dependant on game phase)
           * Added a game phase check that decides if the game is in the opening,
             middle game, ending or pawn ending
           * Added final INFINITY variable instead of using 200000 in the code
           * Cleaned up the line input, currently it can only set up a board with FEN
             and do perft/divide, might be enhanced again in later releases
           * Increased the number of nodes before time or interrupt command are checked,
             hopefully this should take care of the bug where Mediocre stops searching

   v0.2b:  * Transposition tables are implemented along with a new draw detection scheme
           * There is now a zobrist key field in the Board-class, the key is updated when
             making and unmaking moves, but can also be generated from scratch with the
             static getZobristKey-method in the Zobrist-class
           * Changed pv search so it is only used if a best move has been found
           * Sorting moves is now done with a much faster bubble-sort method
           * Changed move generation slightly and added a new filterQuis-method which adds
             the right values to the captures
           * Quiescent search now re-uses the moves generated in the alphaBeta method
           * Mediocre is now developed in Eclipse so the folders look a bit different
           * The .bat-files now point to "/bin/" so they work as long they are kept in the
              original folder (you should not have to update the path in them anymore)
           * Sorting methods are completely rewritten, based on orderingValue
           * Preliminary orderingValues are added to moves at generation time
           * Move-objects now have a orderingValue used in sorting
           * Implemented fixed depth search, call Engine.search() with depth>0 to use,
             call with depth=0 for time control mode
           * The line input can now be used to play games with fixed depth (5 for now)
             if you enter moves on the form "e2e4" etc. It is still very crude and is
             supposed to be used for testing
           * Plus many minor tweaks and changes

   v0.12b: * Time mangement added
           * UCI support added
           * Machine vs. Machine in winboard should now work
           * Added support for the 'force' command in winboard
           * Fixed a bug conerning en passant, perft values are now correct
           * Perft and Tests classes were added, these are best called in the new line mode
           * Calling Mediocre without argument now enters a simple line mode
           * Added a few parameters to Engine.search() to allow uci/winboard thinking,
             fixed depth and time management
           * Added setupStart() to Board, which sets up the initial position

   v0.11b: * Null-moves added
           * Added isInCheck() to the engine class (used by null-moves)
           * Move sorting is now done after the mate check to save time

    v0.1b: * Aspiration windows added
           * Killer moves heuristic added
           * Principal Variation Search added
           * A new opening book, shorter but lets the engine play itself better
