• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

COPYINGH A D05-Apr-201418.2 KiB347291

HISTORYH A D01-May-201620.6 KiB310283

READMEH A D15-Oct-201513.4 KiB274234

bcreate.cH A D24-Aug-201410.1 KiB426351

book.cH A D16-Aug-201411.1 KiB524387

data.cH A D22-Dec-20143.2 KiB11994

easy.cH A D21-Apr-20153.3 KiB12370

eco.phalanxH A D05-Apr-2014167.2 KiB4,3164,315

endgame.cH A D09-Mar-201511 KiB491358

evaluate.cH A D21-Apr-201618.4 KiB803562

genmoves.cH A D19-Mar-201513.6 KiB742619

getopt.cH A D05-Apr-20141.7 KiB8563

hash.cH A D22-Apr-201512.9 KiB379305

io.cH A D22-Aug-201541.2 KiB1,8611,430

killers.cH A D03-May-20153.3 KiB179134

learn.cH A D05-Apr-20141.6 KiB9361

levels.cH A D24-Feb-20164.5 KiB211162

makefileH A D24-Dec-20142 KiB7035

moving.cH A D19-Nov-20147.5 KiB358292

pbook.phalanxH A D01-May-201647.5 KiB857856

phalanx.cH A D15-Oct-201513.3 KiB497425

phalanx.engH A D28-Nov-201430 43

phalanx.hH A D01-May-201611.4 KiB555414

search.cH A D21-Apr-20169 KiB496368

static.cH A D07-Jul-201538.3 KiB1,6421,304

README

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