1*********************************************************
2[December 2006 : added setboard option - Pascal Georges ]
3*********************************************************
4
5Phalanx is a chess playing program
6Copyright (c) 1997, 1998, 1999, 2000 Dusan Dobes
7
8
9LICENSE AND WARRANTY
10
11- Phalanx is free software; you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by
13 the Free Software Foundation; either version 2, or (at your option)
14 any later version.
15- Phalanx is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
19- You should have received a copy of the GNU General Public License
20 along with Phalanx; see the file COPYING. If not, write to
21 the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
22 MA 02111-1307, USA.
23
24
25WHERE TO GET PHALANX
26
27- http://www.crosswinds.net/~dobes/phalanx/
28- ftp://sunsite.unc.edu/pub/Linux/games/strategy/ (Only sources)
29 Sunsite is well maintained archive with lots of mirrors, but it's dedicated
30 to Linux. If you want to try Win32 binary or bigger secondary opening book
31 try following site, it has both sources and Win32 binaries plus opening books
32 largebook.zip and hugebook.zip:
33- ftp://ftp.math.muni.cz/pub/math/people/Dobes/
34- http://www.gambitsoft.com/sharee.htm (Only Win32 binaries)
35- http://www.cent.co.yu/chess/free.htm (Only Win32 binaries)
36
37 Please let me know if there are others, i will update this list.
38 Feel free to put Phalanx on your ftp site.
39
40
41COMPILING, PORTABILITY
42
43 Compiling is simple, at least under Linux. Just type `make'. You might want
44 to edit the optimization flags in makefile to produce faster binary. Phalanx
45 is developed under GNU C, GNU Debugger, and GNU Make. If your system does
46 not support GNU exensions (e.g. long options), remove '-DGNUFUN' from DEFINES
47 in makefile. If you have incompatible 'make', try this:
48 $ cat *.c > allphalanx.c; cc -O allphalanx.c -o phalanx
49
50
51INTERFACE, COMMAND LINE OPTIONS
52
53 Phalanx is xboard compatible. Running with xboard: 'xboard -fcp phalanx'.
54 Note that permanent brain (pondering) is off by default. Newer versions of
55 xboard set it on with the 'hard' command. If this does not work, try
56 'xboard -fcp "phalanx -p+"' or (for <4.0.0 versions of xboard) change your
57 initString (see Xboard documentation for details). It's better to stop
58 permanent brain in both programs, when playing Phalanx against another
59 program on a machine with one CPU.
60 It's also possible to run phalanx without xboard. Do "phalanx -h" to get
61 a list of command line options. One important command of phalanx's ASCII
62 interface is "help".
63
64
65MORE ABOUT INTERFACE
66
67 I'm trying to write an interface that fits following three requirements:
68 - Xboard compatibility. For best results, get the latest version of Xboard.
69 (http://www.research.digital.com/SRC/personal/Tim_Mann/chess)
70 - shell-like interface that allows running commands in a batch. It's very
71 useful for testing. Example: look into the file test.fin. It's a set
72 of chess problems and solutions. You can simply send this file to
73 Phalanx's stdin:
74 $ phalanx -c+ -o- -b- -f10 < test.fin | tee result
75 ( Where: -c+ .... use cpu time
76 -o- .... don't use polling input
77 -b- .... no opening book
78 -f10 ... fixed time 10 seconds per move )
79 Watch how it works.
80 - Acceptable ASCII interface.
81
82
83COMMAND LINE OPTIONS
84
85 Usage:
86 phalanx [options] [<moves> <minutes> [<increment in seconds>]]
87 phalanx [options] [<seconds per move>]
88 phalanx bench
89 phalanx bcreate [book creation options]
90
91 Options:
92 -t <transposition table size in kilobytes>
93 Transposition table really needs to fit in the RAM memory, it should
94 never be swapped to disk. Maximum size is your total RAM minus space
95 needed for OS (8-20 MB) minus space for other (possible) applications.
96 -f <fixed search time in seconds>
97 -x <+/-> xboard mode on/off default: on
98 "Xboard mode off" is designed for the ascii interface. In -s+ mode it
99 shows also the move that is currently searched.
100 -p <+/-> permanent brain on/off default: off
101 Phalanx ponders on a predicted move with the permanent brain on. It is
102 sometimes called pondering. Xboard sets it on with the 'hard' command
103 regardless of this option, just use xboard menu to set it on/off.
104 -s <+/-> show thinking on/off default: off
105 Phalanx shows depth, evaluation, time used in centiseconds, nodes
106 searched, and principal variation (best line) when searching. Xboard
107 overrides this option with 'post' and 'nopost' commands, just use
108 xboard menu instead of this.
109 -c <+/-> cpu time default: off
110 This one defaults to the "wall clock" real time. It's better to use
111 the CPU time when running test suites.
112 -o <+/-> polling input default: on
113 Use -o- for running test suites. Phalanx reads the positions from its
114 standard input and polling input makes it stop thinking after almost
115 zero seconds on each position.
116 -b <+/-> opening book default: on
117 -l <+/-> learning on/off default: on
118 -r <resign value in centipawns> default: 0 (no resigning)
119 -e <easy level 0...100> default: 0 (best play)
120 1 is the hardest and 100 is the easiest easy level. Phalanx tries to
121 emulate human-like blunders, the higher the number the more blunders it
122 plays. It also adds more randomness with the easy levels, repeating
123 games should be impossible. Easy levels set hashtable size to zero,
124 pondering and learning to off. Phalanx responds almost immediatelly to
125 opponent's move. Node count is used instead of the time, so appropriate
126 levels should give the same strength even on different machines
127 (e.g. 486 == Pentium-III).
128 -v
129 Print version and exit.
130 -P <primary book directory>
131 -S <secondary book directory>
132 -L <learning file directory>
133 -g <log file name>
134
135 Book creation options:
136 -b <buffer size in cells>
137 Stage 1. One cell is 10 bytes. Twice the space is needed for sorting
138 the buffer, use no more than 1/3 of your total RAM.
139 -p <maxply>
140 Stage 1. Stop parsing the game at given ply (halfmove). Default value is
141 70, it's 35 full moves.
142 -c <max length of comment>
143 Stage 1. PGN files have comments in {}. Phalanx skips the comments when
144 parsing. Big PGN files also have lots of errors, sometimes '{' does not
145 have matching '}'. So, if the comment goes over the maximal length, we
146 suspect the text is no more the comment and continue parsing. Default
147 value is 4096 bytes.
148 -w <winning move value>
149 Stage 1. We are adding the [position,move] to the database. The side to
150 move won the game. The appropriate database entry gets <winning move
151 value> bonus. Default is 5 points. Use values in 1-10 range.
152 -d <drawing move value>
153 Stage 1. Same as the previous except that the game was drawn. Default
154 value is 2 points.
155 -l <losing move value>
156 Stage 1. Same as the previous except that the side to move lost the
157 game. Default value is 1 point.
158 -u <unknown result move value>
159 Stage 1. Same as the previous except that there is no result of the game
160 in the PGN file, sad and common case. Default value is 1 point.
161 -v <min value of move to add>
162 Stage 2. Moves that have less total points than this value are not
163 added into the sbook.phalanx. Bigger numbers create smaller books.
164 The smallest reasonable number is 10. Default is 15.
165 -g <min value percentage of best move to add others>
166 Stage 2. Use values in 50-100 range. The 2nd, 3rd, and other moves are
167 stripped if their value is less than G% of the value of the best move.
168 The G is decreased in positions where the 1st move value has high enough
169 value to give more variability in frequently played opening, e.g. we
170 want a bit more than just sicilian, maybe 1. ... e5 is also good.
171 50 gives lots of variability and maybe dubious moves, 100 gives almost
172 no variability and only the highest valued moves. Default is 80.
173
174 Examples: phalanx -c+ -s+ -o - -x- -f 60 -t4000
175 xboard -fcp "phalanx -r800"
176 xboard -fcp 'phalanx -e 100'
177
178
179ASCII INTERFACE COMMANDS
180
181 about about Phalanx, show version, copyright info, and settings
182 bd display position (same as 'd')
183 bk show book moves (xboard) - shows ECO code/name and all moves
184 from both primary and secondary opening books. The last line
185 is the text string that is used to identify the position in
186 the pbook.phalanx. Primary book moves are shown along with
187 their probabilities. There is no such probability info for
188 the secondary book moves, as all secondary book moves have
189 equal probability.
190 book enable/disable opening book
191 both machine plays both
192 depth set search depth in plies (xboard). Search will be stopped
193 at given depth, no timing info is used.
194 fen display position in FEN
195 force user plays both (xboard)
196 go switch sides, start computing (xboard)
197 history show game moves in full notation
198 level N M I set level to N moves in M minutes, increment I seconds.
199 Phalanx needs its time info have updated from xboard via
200 the 'time' command to make this level work well.
201 level N set level to fixed time N seconds per move
202 new new game (xboard)
203 post show thinking (xboard)
204 remove take back last move, two plies (xboard)
205 nopost do not show thinking (xboard)
206 quit quit (same as 'exit' or end of file character)
207 score show static evaluation
208 time <N> remaining time is N/100 s (xboard)
209 undo undo last ply (xboard; same as 'u')
210 <FEN position> set test position, start search, show result
211 # comment
212
213
214OPENING BOOK
215
216 From version VI, there are two book files - primary (pbook.phalanx), and
217 secondary (sbook.phalanx). A position is first searched in pbook.phalanx.
218 Only if it's not found there, sbook.phalanx is searched. You can specify
219 book directories via command line (-P, -S) or use environment variables
220 PHALANXPBOOKDIR and PHALANXSBOOKDIR. Otherwise Phalanx tries to find its
221 book files in current directory (./book.phalanx, ./sbook.phalanx) and finally
222 in compiled-in directory (/usr/local/lib/phalanx). You can change the
223 compiled-in directory in makefile.
224 - pbook.phalanx is 'hand'-written, text book. One line per position, sorted.
225 This time, it's bigger than really needed, because it was the only book
226 file till version V. The size will be smaller and the line format might
227 change to EPD+SAN in future.
228 - sbook.phalanx is binary book, generated from large PGN files. Six bytes
229 per move (4 hash key, 2 move). You can generate your own sbook.phalanx
230 with 'phalanx bcreate <options>', like this:
231 $ ./phalanx bcreate < manyGMgames.pgn
232 Book creation has two stages. First stage reads and parses PGN from
233 standard input and creates the 'rbook.phalanx' file. If rbook.phalanx
234 already exists, the first stage is skipped. Second stage filters positions
235 and moves from the rbook.phalanx to sbook.phalanx. First stage needs about
236 30 times more time than the second one. Look at 'book creation options' for
237 more details on creating your sbook.phalanx.
238
239
240ECO DATABASE
241
242 From version XX, Phalanx has ECO database. Command 'bk' can also print ECO
243 code and opening/variation name. This works with xboard 4.0 via
244 "Help"/"Book" menu item. If you want to activate this feature, you must type
245 the 'bk' command (or click the "Help"/"Book" menu item in xboard) once per
246 session in the initial position. Then, the ECO index is created (that might
247 take few seconds on a slow machine). The ECO index is based on positions
248 rather than on moves so transpositions between openings can take place. The
249 eco.phalanx file is taken from Gnuchess distribution (originally eco.pgn, but
250 this is not real pgn).
251
252
253INSIDE THE MACHINE
254
255 Phalanx uses (traditional) 10x12 board implementation. There are three
256 often used board implementations: "8x8" (GNU Chess), "bitboard" (Crafty),
257 and "10x12" (Nimzo, Phalanx). In short, "10x12" is easy to implement and
258 the code and basic data structures are small ( == fast on PC). The engine
259 uses many well known techniques: PVS (principal variation search),
260 transposition/killer table, static-eval cache, history killers, SEE (static
261 exchange evaluator), null move pruning, forward pruning, internal iterative
262 deepening, chess-specific extensions.
263
264
265AUTHOR
266
267 Dusan Dobes, dobes@math.muni.cz
268
269