>From 55a6eef26e0eed0723cd58d009fd1ba1cd357046 Mon Sep 17 00:00:00 2001 From: Michael Vetter Date: Tue, 16 Dec 2014 17:40:48 +0100 Subject: [PATCH 3/3] Remove trailing whitespaces --- doc/gnuchess.texi | 106 +++++++++++++++++++------------------- src/adapter/adapter.cpp | 8 +-- src/adapter/adapter.h | 2 +- src/adapter/attack.cpp | 2 +- src/adapter/attack.h | 2 +- src/adapter/board.cpp | 2 +- src/adapter/board.h | 2 +- src/adapter/book.cpp | 2 +- src/adapter/book.h | 2 +- src/adapter/book_make.cpp | 2 +- src/adapter/book_make.h | 2 +- src/adapter/book_merge.cpp | 2 +- src/adapter/book_merge.h | 2 +- src/adapter/colour.cpp | 2 +- src/adapter/colour.h | 2 +- src/adapter/engine.cpp | 2 +- src/adapter/engine.h | 2 +- src/adapter/epd.cpp | 2 +- src/adapter/epd.h | 2 +- src/adapter/fen.cpp | 2 +- src/adapter/fen.h | 2 +- src/adapter/game.cpp | 2 +- src/adapter/game.h | 2 +- src/adapter/hash.cpp | 2 +- src/adapter/hash.h | 2 +- src/adapter/io.cpp | 2 +- src/adapter/io.h | 2 +- src/adapter/line.cpp | 2 +- src/adapter/line.h | 2 +- src/adapter/list.cpp | 2 +- src/adapter/list.h | 2 +- src/adapter/main.cpp | 2 +- src/adapter/main.h | 2 +- src/adapter/move.cpp | 2 +- src/adapter/move.h | 2 +- src/adapter/move_do.cpp | 2 +- src/adapter/move_do.h | 2 +- src/adapter/move_gen.cpp | 2 +- src/adapter/move_gen.h | 2 +- src/adapter/move_legal.cpp | 2 +- src/adapter/move_legal.h | 2 +- src/adapter/option.cpp | 2 +- src/adapter/option.h | 2 +- src/adapter/parse.cpp | 2 +- src/adapter/parse.h | 2 +- src/adapter/pgn.cpp | 2 +- src/adapter/pgn.h | 2 +- src/adapter/piece.cpp | 2 +- src/adapter/piece.h | 2 +- src/adapter/posix.cpp | 2 +- src/adapter/posix.h | 2 +- src/adapter/random.cpp | 2 +- src/adapter/random.h | 2 +- src/adapter/san.cpp | 2 +- src/adapter/san.h | 2 +- src/adapter/search.cpp | 2 +- src/adapter/search.h | 2 +- src/adapter/square.cpp | 2 +- src/adapter/square.h | 2 +- src/adapter/uci.cpp | 2 +- src/adapter/uci.h | 2 +- src/adapter/util.cpp | 6 +-- src/adapter/util.h | 2 +- src/components.cc | 6 +-- src/components.h | 6 +-- src/engine/book.cpp | 4 +- src/frontend/atak.cc | 40 +++++++-------- src/frontend/cmd.cc | 2 +- src/frontend/common.h | 54 ++++++++++---------- src/frontend/debug.cc | 8 +-- src/frontend/engine.cc | 54 ++++++++++---------- src/frontend/epd.cc | 66 ++++++++++++------------ src/frontend/genmove.cc | 54 ++++++++++---------- src/frontend/init.cc | 52 +++++++++---------- src/frontend/inlines.h | 4 +- src/frontend/lexpgn.cc | 96 +++++++++++++++++------------------ src/frontend/move.cc | 124 ++++++++++++++++++++++----------------------- src/frontend/output.cc | 76 +++++++++++++-------------- src/frontend/pgn.cc | 22 ++++---- src/frontend/players.cc | 14 ++--- src/frontend/solve.cc | 8 +-- src/frontend/swap.cc | 20 ++++---- src/frontend/util.cc | 22 ++++---- src/frontend/version.h | 6 +-- src/main.cc | 74 +++++++++++++-------------- 85 files changed, 526 insertions(+), 526 deletions(-) diff --git a/doc/gnuchess.texi b/doc/gnuchess.texi index 3ad1693..94c6822 100644 --- a/doc/gnuchess.texi +++ b/doc/gnuchess.texi @@ -78,13 +78,13 @@ This manual is for GNU Chess (version @value{VERSION}, @value{UPDATED}). @cindex XBoard @cindex overview -GNU Chess (@url{http://www.gnu.org/software/chess/}) is a computer +GNU Chess (@url{http://www.gnu.org/software/chess/}) is a computer program for playing chess. -It can be used to interactively play chess on a text terminal, -but it is more often used in conjunction with a GUI program such +It can be used to interactively play chess on a text terminal, +but it is more often used in conjunction with a GUI program such as GNU XBoard. -Because it is protected by the GNU General Public License, users are +Because it is protected by the GNU General Public License, users are free (in perpetuity) to share and change it. @cindex author @@ -125,7 +125,7 @@ dabbling in it. You might surprise yourself. If you want to report a possible bug in GNU Chess, please send a message to the e-mail address indicated above, providing precise information -about the conditions that led to the possible bug. As a general +about the conditions that led to the possible bug. As a general guideline, you can kindly include the follow information: @itemize @@ -138,7 +138,7 @@ gnuchess --version @end example @item -How you started the program. Whether running standalone or in +How you started the program. Whether running standalone or in combination with other programs such as XBoard. @item @@ -235,7 +235,7 @@ compatibility. @itemx -p @opindex --post @opindex -p -Start up showing thinking. +Start up showing thinking. Option @option{post} is accepted without leading dashes for backward compatibility. @@ -337,7 +337,7 @@ best - play best move from book worst - play worst move from book random - play any move from book - + prefer (default) - choose a good move from book (Method subject to variation) @@ -395,7 +395,7 @@ Makes the program stop moving. You may now enter moves to reach some position in the future. (Same as @command{gnuchess --manual}) - + @item white @cindex white Program plays black, set white to move. @@ -418,7 +418,7 @@ Computer takes whichever side is on move and begins its thinking immediately @item easy address@hidden easy address@hidden easy Disables thinking on opponent's time (Same as @command{gnuchess --easy}) @@ -514,7 +514,7 @@ off - disables use of xboard/winboard @cindex depth Sets the program to look N ply (half-moves) deep for every search it performs. If there is a checkmate or other condition -that does not allow that depth, then it will not be +that does not allow that depth, then it will not be @item level MOVES MINUTES INCREMENT @cindex level @@ -536,7 +536,7 @@ Saves game position into EPD format from memory to disk. @item switch @cindex switch Switches side to move - + Note: not implemented in this version. @item solve FILENAME @@ -598,10 +598,10 @@ Note: not implemented in this version. @item analyze @cindex analyze Switches program into analysis mode, this is primarily intended for -communicating analysis to an external interface using the Xboard +communicating analysis to an external interface using the Xboard chess engine protocol. It enables "force", "post", and "hard", at the same time, whilst altering the -output format of post to conform with the engine protocol. +output format of post to conform with the engine protocol. @item graphic @cindex graphic @@ -613,7 +613,7 @@ The graphic mode requires a terminal with Unicode support. @item nographic @cindex nographic -Disables graphic mode. The board is displayed using the good-old +Disables graphic mode. The board is displayed using the good-old classic view based on plain ASCII. @end table @@ -626,7 +626,7 @@ classic view based on plain ASCII. If @env{GNUCHESS_PKGDATADIR} is defined, it will be taken as the path for the config file and for the book, in case the files are not found in the -current directory. If it is not defined, they will be taken from the +current directory. If it is not defined, they will be taken from the package data directory, in case the files are not found in the current directory. @@ -681,7 +681,7 @@ Note: use INI syntax, not UCI. For example @option{OwnBook = true} is correct. It will be replaced by the adapter with @option{setoption name OwnBook value true} at engine startup. -Standard UCI options are @option{Hash}, @option{NalimovPath}, +Standard UCI options are @option{Hash}, @option{NalimovPath}, @option{NalimovCache} and @option{OwnBook}. Hidden options like @option{Ponder} or @option{UCI_xxx} are automatic and should not be put in the INI file. @@ -790,7 +790,7 @@ Of course, full path can be used in which case the current directory does not matter. If the file is not found in the current directory, it will be looked for -in @var{GNUCHESS_PKGDATADIR} if the variable is defined, or in +in @var{GNUCHESS_PKGDATADIR} if the variable is defined, or in the package data directory otherwise. Note that there is no option to control book usage. All parameters @@ -940,7 +940,7 @@ by setting "Material" to a low value. @end table -The following options were used in PolyGlot v1.4, but are deprecated in +The following options were used in PolyGlot v1.4, but are deprecated in GNU Chess: @table @code @@ -1046,17 +1046,17 @@ name will do the job. @option{Log = true} @item @file{log.nnn} -This file is written if command @command{name} was requested. -The contents are the opponent's name and the game in +This file is written if command @command{name} was requested. +The contents are the opponent's name and the game in coordinate algebraic notation. @item @file{game.nnn} -This file is written if command @command{name} was requested. -The contents are the opponent's name and the game in +This file is written if command @command{name} was requested. +The contents are the opponent's name and the game in portable game notation (PGN). @item @file{players.dat} -This file is written if command @command{name} was requested. +This file is written if command @command{name} was requested. The contents are the statistics of games. This is the format of each line: @@ -1097,7 +1097,7 @@ Running the program with the "--xboard" command line parameter sets it to produce output acceptable to and accept input suitable for XBoard and WinBoard, the graphical display front-ends with mouse interface. -For historical reasons the option "xboard" does not need to be +For historical reasons the option "xboard" does not need to be preceeded by "--", however we would encourage the new syntax. How to run XBoard with GNU Chess as chess backend: @@ -1131,7 +1131,7 @@ See Zippy documentation in the XBoard/WinrBoard distribution: @uref{http://www.tim-mann.org/} -this is an example of how to run GNU Chess on FICS using +this is an example of how to run GNU Chess on FICS using XBoard as frontend and Zippy as connector: @example @@ -1148,7 +1148,7 @@ See options @option{Book} and @option{Bookfile} in Running GNU Chess - Configura @node Tests @chapter Tests -GNU Chess 6 has been tested on the Free Internet Chess Server +GNU Chess 6 has been tested on the Free Internet Chess Server (@uref{http://www.freechess.org}) with XBoard. @node Chess notation @@ -1197,7 +1197,7 @@ reporting bugs and keeping track of your games. @cindex Letouzey, Fabien The first version of GNU Chess was written by Stuart Cracraft back in 1984. -Versions from 2 to 4 were written by John Stanback. Version 5 was written +Versions from 2 to 4 were written by John Stanback. Version 5 was written by Chua Kong-Sian. Version 6 was written by Fabien Letouzey. @@ -1246,12 +1246,12 @@ pondering/remaining-time relation. @cindex Fruit @cindex Letouzey, Fabien Since version 5.07 of the program was released in 2003, GNU Chess has basically -remained unchanged. Then Fabien Letouzey developped Fruit, which -proved to be a stronger chess engine and shaked the computer chess world. +remained unchanged. Then Fabien Letouzey developped Fruit, which +proved to be a stronger chess engine and shaked the computer chess world. At some point in time, he kindly assigned copyright to FSF, which allowed us -to make Fruit 2.1 (the latest free version) the base for GNU Chess v6. +to make Fruit 2.1 (the latest free version) the base for GNU Chess v6. -Therefore, it can be fairly said that Fabien Letouzey is remarkably the main +Therefore, it can be fairly said that Fabien Letouzey is remarkably the main contributor to GNU Chess v6. @node Guidelines followed to develop GNU Chess v6 @@ -1262,10 +1262,10 @@ The idea was to use Fruit 2.1 as the base for GNU Chess v6, keeping external interfaces backwards compatible. This is particularly important since GNU Chess has been world-wide used for long. -GNU Chess can be used in two modes: interactively using the command-line -interface on a text console, and used as backend engine from a graphical +GNU Chess can be used in two modes: interactively using the command-line +interface on a text console, and used as backend engine from a graphical frontend. Both cases rely on almost identical grammar. The former is described -in GNU Chess help. +in GNU Chess help. @cindex Chess Engine Communication Protocol When GNU Chess is used as a pure chess engine, for instance, as backend for @@ -1291,7 +1291,7 @@ option is specified. @cindex adapter @cindex protocol UCI is very different from the Chess Engine Communication Protocol. -PolyGlot is a UCI-to-xboard adapter developed by Fabien. +PolyGlot is a UCI-to-xboard adapter developed by Fabien. It connects a UCI chess engine to an xboard interface such as WinBoard. UCI2WB is another such adapter (for Windows). @@ -1306,8 +1306,8 @@ PolyGlot tries to solve known problems with other adapters. For instance, it detects and reports draws by fifty-move rule, repetition, etc. -PolyGlot 1.4 has been adapted and incorporated to GNU Chess v6 as -chess engine protocol adapter. It connects Fruit-based GNU Chess engine to +PolyGlot 1.4 has been adapted and incorporated to GNU Chess v6 as +chess engine protocol adapter. It connects Fruit-based GNU Chess engine to the good old GNU Chess frontend. @node Structure of the source code @@ -1328,8 +1328,8 @@ adapter engine @end itemize -The main program contains the frontend and starts two addtional threads, -one for the adapter, and another one for the engine. The three components +The main program contains the frontend and starts two addtional threads, +one for the adapter, and another one for the engine. The three components comprise a chain, thus there are two links: @itemize @@ -1345,11 +1345,11 @@ mechanisms such as mutex. The changes in PolyGlot and Fruit are minimal, since they were already using the same mechanism to communicate with each other. Another technical problem was the fact that GNU Chess v5 was written in C, -whereas PolyGlot and Fruit are written in C++. In GNU Chess v6 the main +whereas PolyGlot and Fruit are written in C++. In GNU Chess v6 the main program, the adapter and the engine are in C++, but the frontend remains in C. Source code was placed under a single @file{src} in GNU Chess v5, as usual. -Three additional directories have been created for GNU Chess v6, +Three additional directories have been created for GNU Chess v6, so the code is organized in four directories: @table @file @@ -1364,7 +1364,7 @@ communicate the three modules: frontend, adapter and engine. @cindex src/frontend Contains the frontend. The code here is inherited from GNU Chess v5, with some -modifications mainly in @file{cmd.c} and a new file @file{engine.c} which +modifications mainly in @file{cmd.c} and a new file @file{engine.c} which addresses the message passing through modules. @item src/adapter @@ -1382,9 +1382,9 @@ Contains the chess engine, based on Fruit 2.1. Minor changes wrt the baseline. @cindex binary @cindex library -The sources in each @file{src} subdirectory are compiled as a static library. -When link with the sources in top @file{src}, they result into the binary address@hidden The module libraries are named after their respective +The sources in each @file{src} subdirectory are compiled as a static library. +When link with the sources in top @file{src}, they result into the binary address@hidden The module libraries are named after their respective directory name: @example @@ -1398,8 +1398,8 @@ libengine.a @cindex C @cindex C++ -The source code of the frontend comes mainly from version 5.07, which was -written in C. There is no problem in having both C and C++ in the same +The source code of the frontend comes mainly from version 5.07, which was +written in C. There is no problem in having both C and C++ in the same program, and so have they lived together in all versions from 6.0.0 to 6.1.0. However, in version 6.1.1 and subsequent versions the frontend is compiled in C++. This change has been introduced to avoid compilation warnings in @@ -1537,7 +1537,7 @@ history pruning and hence not activated by default) @item Move ordering (bad captures are postponed) @item History pruning (not tested seriously yet enabled by default) - + @end itemize @node Speed @@ -1551,16 +1551,16 @@ to make the code shorter and more flexible. @node Translations @chapter Translations -English is the native language of GNU Chess, as usual in the +English is the native language of GNU Chess, as usual in the GNU Project. Starting on version 6.1.0, GNU Chess features internationalization support based on GNU @command{gettext}. The Translation Project -contributes message strings translated into other languages. See the +contributes message strings translated into other languages. See the @uref{http://translationproject.org/domain/gnuchess.html, Translation Project page for GNU Chess} for the currently available translations. -During the installation of the operating system, the language to +During the installation of the operating system, the language to be used is selected. This selection is made system-wide. An individual user can select his or her own language by setting the `locale' through environment variables. Typically, a command like this @@ -1570,7 +1570,7 @@ An individual user can select his or her own language by setting the export LANGUAGE=de_DE @end example -See details on this at +See details on this at @uref{http://www.gnu.org/software/gettext/manual/gettext.html#Users} diff --git a/src/adapter/adapter.cpp b/src/adapter/adapter.cpp index d6d09b2..fe4f116 100644 --- a/src/adapter/adapter.cpp +++ b/src/adapter/adapter.cpp @@ -683,7 +683,7 @@ static void xboard_step() { } } - } else + } else // Extended commands from GNU Chess frontend @@ -693,10 +693,10 @@ static void xboard_step() { // Subcommands: add, on, off, prefer, random, best, worst char *my_argv[4]; char *token; - token = strtok( Star[0], " " ); + token = strtok( Star[0], " " ); if ( strcmp( token, "add" ) == 0 ) { - token = strtok( NULL, " " ); + token = strtok( NULL, " " ); my_argv[0] = (char *)malloc( 2 ); my_argv[1] = (char *)malloc( 10 ); my_argv[2] = (char *)malloc( 5 ); @@ -752,7 +752,7 @@ static void xboard_step() { char *token; unsigned int memory; - token = strtok( Star[0], " " ); + token = strtok( Star[0], " " ); if ( sscanf( token, "%d", &memory ) == 1 ) { HashSize = memory; uci_send_option(Uci,"Hash","%d",HashSize); diff --git a/src/adapter/adapter.h b/src/adapter/adapter.h index 3f1eeed..4bff258 100644 --- a/src/adapter/adapter.h +++ b/src/adapter/adapter.h @@ -29,7 +29,7 @@ #include "util.h" namespace adapter { - + // functions extern void adapter_loop (); diff --git a/src/adapter/attack.cpp b/src/adapter/attack.cpp index e08251e..2093b0c 100644 --- a/src/adapter/attack.cpp +++ b/src/adapter/attack.cpp @@ -36,7 +36,7 @@ #define DELTA_MASK(delta) (DeltaMask[128+(delta)]) namespace adapter { - + // "constants" const sint8 KnightInc[8+1] = { diff --git a/src/adapter/attack.h b/src/adapter/attack.h index 793cf66..715a95b 100644 --- a/src/adapter/attack.h +++ b/src/adapter/attack.h @@ -30,7 +30,7 @@ #include "util.h" namespace adapter { - + // constants const int IncNone = 0; diff --git a/src/adapter/board.cpp b/src/adapter/board.cpp index 627280c..978cc37 100644 --- a/src/adapter/board.cpp +++ b/src/adapter/board.cpp @@ -39,7 +39,7 @@ #include "util.h" namespace adapter { - + // constants static const bool UseSlowDebug = false; diff --git a/src/adapter/board.h b/src/adapter/board.h index dcb5888..6b383ef 100644 --- a/src/adapter/board.h +++ b/src/adapter/board.h @@ -31,7 +31,7 @@ #include "util.h" namespace adapter { - + // constants const int Empty = 0; diff --git a/src/adapter/book.cpp b/src/adapter/book.cpp index e368060..80c47fb 100644 --- a/src/adapter/book.cpp +++ b/src/adapter/book.cpp @@ -36,7 +36,7 @@ #include "util.h" namespace adapter { - + // types struct entry_t { diff --git a/src/adapter/book.h b/src/adapter/book.h index 59fc061..d9a5513 100644 --- a/src/adapter/book.h +++ b/src/adapter/book.h @@ -30,7 +30,7 @@ #include "util.h" namespace adapter { - + // constants const int BookReadOnly = 1; diff --git a/src/adapter/book_make.cpp b/src/adapter/book_make.cpp index 0599f82..92e94c6 100644 --- a/src/adapter/book_make.cpp +++ b/src/adapter/book_make.cpp @@ -40,7 +40,7 @@ #include "book_make.h" namespace adapter { - + // constants static const int COUNT_MAX = 16384; diff --git a/src/adapter/book_make.h b/src/adapter/book_make.h index a285a97..b3353ad 100644 --- a/src/adapter/book_make.h +++ b/src/adapter/book_make.h @@ -29,7 +29,7 @@ #include "util.h" namespace adapter { - + // functions extern void book_make (int argc, char * argv[]); diff --git a/src/adapter/book_merge.cpp b/src/adapter/book_merge.cpp index 3484309..d7730c6 100644 --- a/src/adapter/book_merge.cpp +++ b/src/adapter/book_merge.cpp @@ -32,7 +32,7 @@ #include "util.h" namespace adapter { - + // types struct book_t { diff --git a/src/adapter/book_merge.h b/src/adapter/book_merge.h index d719cab..12b5af4 100644 --- a/src/adapter/book_merge.h +++ b/src/adapter/book_merge.h @@ -29,7 +29,7 @@ #include "util.h" namespace adapter { - + // functions extern void book_merge (int argc, char * argv[]); diff --git a/src/adapter/colour.cpp b/src/adapter/colour.cpp index de1567b..8bb79a3 100644 --- a/src/adapter/colour.cpp +++ b/src/adapter/colour.cpp @@ -27,7 +27,7 @@ #include "util.h" namespace adapter { - + // functions // colour_is_ok() diff --git a/src/adapter/colour.h b/src/adapter/colour.h index 39abae7..d84cee8 100644 --- a/src/adapter/colour.h +++ b/src/adapter/colour.h @@ -29,7 +29,7 @@ #include "util.h" namespace adapter { - + // constants const int BlackFlag = 1 << 0; diff --git a/src/adapter/engine.cpp b/src/adapter/engine.cpp index a9073df..abf8b08 100644 --- a/src/adapter/engine.cpp +++ b/src/adapter/engine.cpp @@ -39,7 +39,7 @@ #include "components.h" namespace adapter { - + // constants static const bool UseNice = false; diff --git a/src/adapter/engine.h b/src/adapter/engine.h index 8938af1..5a29d61 100644 --- a/src/adapter/engine.h +++ b/src/adapter/engine.h @@ -30,7 +30,7 @@ #include "util.h" namespace adapter { - + // types struct engine_t { diff --git a/src/adapter/epd.cpp b/src/adapter/epd.cpp index fb87631..c9771b5 100644 --- a/src/adapter/epd.cpp +++ b/src/adapter/epd.cpp @@ -42,7 +42,7 @@ #include "util.h" namespace adapter { - + // constants static const bool UseDebug = false; diff --git a/src/adapter/epd.h b/src/adapter/epd.h index c2da47a..570a55b 100644 --- a/src/adapter/epd.h +++ b/src/adapter/epd.h @@ -29,7 +29,7 @@ #include "util.h" namespace adapter { - + // functions extern void epd_test (int argc, char * argv[]); diff --git a/src/adapter/fen.cpp b/src/adapter/fen.cpp index 4785b7a..79aedd2 100644 --- a/src/adapter/fen.cpp +++ b/src/adapter/fen.cpp @@ -36,7 +36,7 @@ #include "util.h" namespace adapter { - + // "constants" // const char * StartFen = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w HAha - 0 1"; diff --git a/src/adapter/fen.h b/src/adapter/fen.h index 3dd220f..197e003 100644 --- a/src/adapter/fen.h +++ b/src/adapter/fen.h @@ -30,7 +30,7 @@ #include "util.h" namespace adapter { - + // "constants" extern const char * StartFen; diff --git a/src/adapter/game.cpp b/src/adapter/game.cpp index dc9d10a..916bc4c 100644 --- a/src/adapter/game.cpp +++ b/src/adapter/game.cpp @@ -36,7 +36,7 @@ #include "util.h" namespace adapter { - + // constants static const bool UseSlowDebug = false; diff --git a/src/adapter/game.h b/src/adapter/game.h index c7aaaa7..8e1d42f 100644 --- a/src/adapter/game.h +++ b/src/adapter/game.h @@ -31,7 +31,7 @@ #include "util.h" namespace adapter { - + // constants const int GameSize = 4096; diff --git a/src/adapter/hash.cpp b/src/adapter/hash.cpp index 74b5e25..5ce3630 100644 --- a/src/adapter/hash.cpp +++ b/src/adapter/hash.cpp @@ -31,7 +31,7 @@ #include "util.h" namespace adapter { - + // variables static uint64 Castle64[16]; diff --git a/src/adapter/hash.h b/src/adapter/hash.h index b25a9af..a9f29c6 100644 --- a/src/adapter/hash.h +++ b/src/adapter/hash.h @@ -30,7 +30,7 @@ #include "util.h" namespace adapter { - + // constants const int RandomPiece = 0; // 12 * 64 diff --git a/src/adapter/io.cpp b/src/adapter/io.cpp index a761f31..ec0d1ab 100644 --- a/src/adapter/io.cpp +++ b/src/adapter/io.cpp @@ -36,7 +36,7 @@ #include "util.h" namespace adapter { - + // constants static const bool UseDebug = false; diff --git a/src/adapter/io.h b/src/adapter/io.h index c6031d7..f508661 100644 --- a/src/adapter/io.h +++ b/src/adapter/io.h @@ -29,7 +29,7 @@ #include "util.h" namespace adapter { - + // constants const int BufferSize = 16384; diff --git a/src/adapter/line.cpp b/src/adapter/line.cpp index 2b778c0..bbb9106 100644 --- a/src/adapter/line.cpp +++ b/src/adapter/line.cpp @@ -34,7 +34,7 @@ #include "util.h" namespace adapter { - + // constants static const bool Strict = false; // false diff --git a/src/adapter/line.h b/src/adapter/line.h index 8204f3f..f1fa612 100644 --- a/src/adapter/line.h +++ b/src/adapter/line.h @@ -31,7 +31,7 @@ #include "util.h" namespace adapter { - + // constants const int LineSize = 256; diff --git a/src/adapter/list.cpp b/src/adapter/list.cpp index e8a19ae..5ad62d5 100644 --- a/src/adapter/list.cpp +++ b/src/adapter/list.cpp @@ -29,7 +29,7 @@ #include "util.h" namespace adapter { - + // functions // list_is_ok() diff --git a/src/adapter/list.h b/src/adapter/list.h index 0f545d6..e0b9fd3 100644 --- a/src/adapter/list.h +++ b/src/adapter/list.h @@ -31,7 +31,7 @@ #include "util.h" namespace adapter { - + // constants const int ListSize = 256; diff --git a/src/adapter/main.cpp b/src/adapter/main.cpp index b303556..bdbc2af 100644 --- a/src/adapter/main.cpp +++ b/src/adapter/main.cpp @@ -52,7 +52,7 @@ #include "util.h" namespace adapter { - + // constants static const char * const Version = "1.4"; diff --git a/src/adapter/main.h b/src/adapter/main.h index 5e1f4e8..006e123 100644 --- a/src/adapter/main.h +++ b/src/adapter/main.h @@ -29,7 +29,7 @@ #include "util.h" namespace adapter { - + // functions extern void quit (); diff --git a/src/adapter/move.cpp b/src/adapter/move.cpp index 4052869..d343523 100644 --- a/src/adapter/move.cpp +++ b/src/adapter/move.cpp @@ -39,7 +39,7 @@ #include "util.h" namespace adapter { - + // "constants" static const uint8 PromotePiece[5] = { PieceNone64, Knight64, Bishop64, Rook64, Queen64 }; diff --git a/src/adapter/move.h b/src/adapter/move.h index 18bef4d..aa64645 100644 --- a/src/adapter/move.h +++ b/src/adapter/move.h @@ -30,7 +30,7 @@ #include "util.h" namespace adapter { - + // constants const int MoveNone = 0; // HACK: a1a1 cannot be a legal move diff --git a/src/adapter/move_do.cpp b/src/adapter/move_do.cpp index e101dfd..9e1d4ea 100644 --- a/src/adapter/move_do.cpp +++ b/src/adapter/move_do.cpp @@ -36,7 +36,7 @@ #include "util.h" namespace adapter { - + // prototypes static void square_clear (board_t * board, int square, int piece); diff --git a/src/adapter/move_do.h b/src/adapter/move_do.h index 532150a..26f9d54 100644 --- a/src/adapter/move_do.h +++ b/src/adapter/move_do.h @@ -30,7 +30,7 @@ #include "util.h" namespace adapter { - + // functions extern void move_do (board_t * board, int move); diff --git a/src/adapter/move_gen.cpp b/src/adapter/move_gen.cpp index 48b99d4..3769b5e 100644 --- a/src/adapter/move_gen.cpp +++ b/src/adapter/move_gen.cpp @@ -34,7 +34,7 @@ #include "util.h" namespace adapter { - + // prototypes static void add_all_moves (list_t * list, const board_t * board); diff --git a/src/adapter/move_gen.h b/src/adapter/move_gen.h index 1d060e0..d8a3f92 100644 --- a/src/adapter/move_gen.h +++ b/src/adapter/move_gen.h @@ -31,7 +31,7 @@ #include "util.h" namespace adapter { - + // functions extern void gen_legal_moves (list_t * list, const board_t * board); diff --git a/src/adapter/move_legal.cpp b/src/adapter/move_legal.cpp index d54a40e..62bf6cf 100644 --- a/src/adapter/move_legal.cpp +++ b/src/adapter/move_legal.cpp @@ -36,7 +36,7 @@ #include "util.h" namespace adapter { - + // prototypes static bool move_is_legal_debug (int move, const board_t * board); diff --git a/src/adapter/move_legal.h b/src/adapter/move_legal.h index c770681..b03e70f 100644 --- a/src/adapter/move_legal.h +++ b/src/adapter/move_legal.h @@ -31,7 +31,7 @@ #include "util.h" namespace adapter { - + // functions extern bool move_is_pseudo (int move, const board_t * board); diff --git a/src/adapter/option.cpp b/src/adapter/option.cpp index 6b87b6d..197bac1 100644 --- a/src/adapter/option.cpp +++ b/src/adapter/option.cpp @@ -30,7 +30,7 @@ #include "util.h" namespace adapter { - + // constants static const bool UseDebug = false; diff --git a/src/adapter/option.h b/src/adapter/option.h index 47b4b63..afef85b 100644 --- a/src/adapter/option.h +++ b/src/adapter/option.h @@ -29,7 +29,7 @@ #include "util.h" namespace adapter { - + // functions extern void option_init (); diff --git a/src/adapter/parse.cpp b/src/adapter/parse.cpp index e690a9b..fcf3b85 100644 --- a/src/adapter/parse.cpp +++ b/src/adapter/parse.cpp @@ -29,7 +29,7 @@ #include "util.h" namespace adapter { - + // constants static const int StringSize = 256; diff --git a/src/adapter/parse.h b/src/adapter/parse.h index 94e3042..5903c52 100644 --- a/src/adapter/parse.h +++ b/src/adapter/parse.h @@ -29,7 +29,7 @@ #include "util.h" namespace adapter { - + // constants const int STAR_NUMBER = 16; diff --git a/src/adapter/pgn.cpp b/src/adapter/pgn.cpp index c3ef702..57f74b0 100644 --- a/src/adapter/pgn.cpp +++ b/src/adapter/pgn.cpp @@ -32,7 +32,7 @@ #include "util.h" namespace adapter { - + // constants static const bool DispMove = false; diff --git a/src/adapter/pgn.h b/src/adapter/pgn.h index b58411b..d484b5a 100644 --- a/src/adapter/pgn.h +++ b/src/adapter/pgn.h @@ -31,7 +31,7 @@ #include "util.h" namespace adapter { - + // constants const int PGN_STRING_SIZE = 256; diff --git a/src/adapter/piece.cpp b/src/adapter/piece.cpp index eb30eac..522b691 100644 --- a/src/adapter/piece.cpp +++ b/src/adapter/piece.cpp @@ -30,7 +30,7 @@ #include "util.h" namespace adapter { - + // "constants" static const uint8 MakePawn[ColourNb] = { PieceNone256, BlackPawn256, WhitePawn256 }; // -BW diff --git a/src/adapter/piece.h b/src/adapter/piece.h index a911825..08c37eb 100644 --- a/src/adapter/piece.h +++ b/src/adapter/piece.h @@ -30,7 +30,7 @@ #include "util.h" namespace adapter { - + // constants const int BlackPawnFlag = 1 << 2; diff --git a/src/adapter/posix.cpp b/src/adapter/posix.cpp index 7e6f440..c865e16 100644 --- a/src/adapter/posix.cpp +++ b/src/adapter/posix.cpp @@ -37,7 +37,7 @@ #include "util.h" namespace adapter { - + // prototypes static double duration (const struct timeval *t); diff --git a/src/adapter/posix.h b/src/adapter/posix.h index 633e265..cba9405 100644 --- a/src/adapter/posix.h +++ b/src/adapter/posix.h @@ -29,7 +29,7 @@ #include "util.h" namespace adapter { - + // functions extern bool input_available (); diff --git a/src/adapter/random.cpp b/src/adapter/random.cpp index fcb2111..086aa83 100644 --- a/src/adapter/random.cpp +++ b/src/adapter/random.cpp @@ -27,7 +27,7 @@ #include "util.h" namespace adapter { - + // "constants" const uint64 Random64[RandomNb] = { diff --git a/src/adapter/random.h b/src/adapter/random.h index 25e774a..ef743e8 100644 --- a/src/adapter/random.h +++ b/src/adapter/random.h @@ -29,7 +29,7 @@ #include "util.h" namespace adapter { - + // constants const int RandomNb = 781; diff --git a/src/adapter/san.cpp b/src/adapter/san.cpp index 477a037..d1706e0 100644 --- a/src/adapter/san.cpp +++ b/src/adapter/san.cpp @@ -40,7 +40,7 @@ #include "util.h" namespace adapter { - + // constants static const bool UseSlowDebug = false; diff --git a/src/adapter/san.h b/src/adapter/san.h index 4270e5f..831ecf4 100644 --- a/src/adapter/san.h +++ b/src/adapter/san.h @@ -30,7 +30,7 @@ #include "util.h" namespace adapter { - + // functions extern bool move_to_san (int move, const board_t * board, char string[], int size); diff --git a/src/adapter/search.cpp b/src/adapter/search.cpp index 2d3854e..f740c60 100644 --- a/src/adapter/search.cpp +++ b/src/adapter/search.cpp @@ -46,7 +46,7 @@ #include "util.h" namespace adapter { - + // variables static int Depth; diff --git a/src/adapter/search.h b/src/adapter/search.h index 2573e94..983c76e 100644 --- a/src/adapter/search.h +++ b/src/adapter/search.h @@ -30,7 +30,7 @@ #include "util.h" namespace adapter { - + // constants const int DepthMax = 63; diff --git a/src/adapter/square.cpp b/src/adapter/square.cpp index 20c8f2c..2316ef7 100644 --- a/src/adapter/square.cpp +++ b/src/adapter/square.cpp @@ -28,7 +28,7 @@ #include "util.h" namespace adapter { - + // "constants" static const uint8 SquareFrom64[64] = { diff --git a/src/adapter/square.h b/src/adapter/square.h index 1e1ae6e..301bdeb 100644 --- a/src/adapter/square.h +++ b/src/adapter/square.h @@ -29,7 +29,7 @@ #include "util.h" namespace adapter { - + // constants const int SquareNb = 16 * 12; diff --git a/src/adapter/uci.cpp b/src/adapter/uci.cpp index e933b8d..1909680 100644 --- a/src/adapter/uci.cpp +++ b/src/adapter/uci.cpp @@ -40,7 +40,7 @@ #include "util.h" namespace adapter { - + // constants static const bool UseDebug = false; diff --git a/src/adapter/uci.h b/src/adapter/uci.h index 1b121e6..b6e5ead 100644 --- a/src/adapter/uci.h +++ b/src/adapter/uci.h @@ -33,7 +33,7 @@ #include "util.h" namespace adapter { - + // constants const int OptionNb = 256; diff --git a/src/adapter/util.cpp b/src/adapter/util.cpp index 15c9401..a1ca513 100644 --- a/src/adapter/util.cpp +++ b/src/adapter/util.cpp @@ -38,7 +38,7 @@ #include "configmake.h" namespace adapter { - + // constant variables const int MaxFileNameSize = 256; @@ -235,7 +235,7 @@ bool my_file_read_line(FILE * file, char string[], int size) { src = 0; dst = 0; - + while ((c=string[src++]) != '\0') { if (c != '\r' && c != '\n') string[dst++] = c; } @@ -421,7 +421,7 @@ double my_timer_cpu_usage(const my_timer_t * timer) { char const * compute_pkgdatadir () { - + char const *pkgdatadir = getenv ("GNUCHESS_PKGDATADIR"); return pkgdatadir ? pkgdatadir : PKGDATADIR; } diff --git a/src/adapter/util.h b/src/adapter/util.h index 87be9c8..c8d9f23 100644 --- a/src/adapter/util.h +++ b/src/adapter/util.h @@ -69,7 +69,7 @@ #endif namespace adapter { - + // constant variables extern const int MaxFileNameSize; diff --git a/src/components.cc b/src/components.cc index 2ed0241..a4d5218 100644 --- a/src/components.cc +++ b/src/components.cc @@ -2,7 +2,7 @@ Copyright (c) 2001-2012 Free Software Foundation, Inc. - GNU Chess is based on the two research programs + GNU Chess is based on the two research programs Cobalt by Chua Kong-Sian and Gazebo by Stuart Cracraft. This program is free software: you can redistribute it and/or modify @@ -16,9 +16,9 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see . + along with this program. If not, see . - Contact Info: + Contact Info: address@hidden address@hidden, address@hidden, address@hidden */ diff --git a/src/components.h b/src/components.h index ecf68b7..7a59267 100644 --- a/src/components.h +++ b/src/components.h @@ -2,7 +2,7 @@ Copyright (c) 2001-2012 Free Software Foundation, Inc. - GNU Chess is based on the two research programs + GNU Chess is based on the two research programs Cobalt by Chua Kong-Sian and Gazebo by Stuart Cracraft. This program is free software: you can redistribute it and/or modify @@ -16,9 +16,9 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see . + along with this program. If not, see . - Contact Info: + Contact Info: address@hidden address@hidden, address@hidden, address@hidden */ diff --git a/src/engine/book.cpp b/src/engine/book.cpp index 335613a..d4e0415 100644 --- a/src/engine/book.cpp +++ b/src/engine/book.cpp @@ -37,7 +37,7 @@ namespace engine { -// constants +// constants static const int MaxFileNameSize = 256; @@ -172,7 +172,7 @@ int book_move(board_t * board) { && MOVE_FROM(best_move) == E8 && MOVE_TO(best_move) == H8 ) return move; if (MOVE_FROM(move) == E8 && MOVE_TO(move) == C8 && MOVE_FROM(best_move) == E8 && MOVE_TO(best_move) == A8 ) return move; - + if ((move & 07777) == best_move) return move; } } diff --git a/src/frontend/atak.cc b/src/frontend/atak.cc index 14ac11f..ef19d87 100644 --- a/src/frontend/atak.cc +++ b/src/frontend/atak.cc @@ -4,7 +4,7 @@ Copyright (C) 2001-2011 Free Software Foundation, Inc. - GNU Chess is based on the two research programs + GNU Chess is based on the two research programs Cobalt by Chua Kong-Sian and Gazebo by Stuart Cracraft. This program is free software: you can redistribute it and/or modify @@ -20,7 +20,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - Contact Info: + Contact Info: address@hidden address@hidden, address@hidden, address@hidden */ @@ -39,7 +39,7 @@ short SqAtakd (short sq, short side) { register BitBoard *a, b, *c, d, blocker; int t; - + a = board.b[side]; /* Knights */ @@ -53,19 +53,19 @@ short SqAtakd (short sq, short side) /* Pawns */ if (a[pawn] & MoveArray[ptype[1^side]][sq]) return (true); - + c = FromToRay[sq]; blocker = board.blocker; /* Bishops & Queen */ b = (a[bishop] | a[queen]) & MoveArray[bishop][sq]; - d = ~b & blocker; + d = ~b & blocker; while (b) { t = leadz (b); if (!(c[t] & d)) return (true); - CLEARBIT (b, t); + CLEARBIT (b, t); } /* Rooks & Queen */ @@ -76,7 +76,7 @@ short SqAtakd (short sq, short side) t = leadz (b); if (!(c[t] & d)) return (true); - CLEARBIT (b, t); + CLEARBIT (b, t); } return (false); } @@ -91,18 +91,18 @@ BitBoard AttackTo (int sq, int side) { register BitBoard *a, b, *c, e, blocker; int t; - + a = board.b[side]; /* Knights */ - e = (a[knight] & MoveArray[knight][sq]); + e = (a[knight] & MoveArray[knight][sq]); /* Kings */ - e |= (a[king] & MoveArray[king][sq]); + e |= (a[king] & MoveArray[king][sq]); /* Pawns */ e |= (a[pawn] & MoveArray[ptype[1^side]][sq]); - + c = FromToRay[sq]; blocker = board.blocker; @@ -111,7 +111,7 @@ BitBoard AttackTo (int sq, int side) while (b) { t = leadz (b); - CLEARBIT (b, t); + CLEARBIT (b, t); if (!(c[t] & blocker & NotBitPosArray[t])) e |= BitPosArray[t]; } @@ -121,20 +121,20 @@ BitBoard AttackTo (int sq, int side) while (b) { t = leadz (b); - CLEARBIT (b, t); + CLEARBIT (b, t); if (!(c[t] & blocker & NotBitPosArray[t])) e |= BitPosArray[t]; } return (e); } - + int PinnedOnKing (int sq, int side) /*************************************************************************** * * Determine if the piece on sq is pinned against the King. - * Side is the color of the piece. + * Side is the color of the piece. * Caveat: PinnedOnKing should only be called by GenCheckEscapes(). * The more generic FindPins() function should be used for evaluating * pins against other pieces. @@ -151,7 +151,7 @@ int PinnedOnKing (int sq, int side) xside = 1 ^ side; blocker = board.blocker; - + /* Path from piece to king is blocked, so no pin */ if (FromToRay[KingSq][sq] & NotBitPosArray[sq] & blocker) return (false); @@ -161,12 +161,12 @@ int PinnedOnKing (int sq, int side) sq1 = (sq > KingSq ? leadz (b) : trailz (b)); /* If diagonal */ - if (dir <= 3 && + if (dir <= 3 && BitPosArray[sq1] & (board.b[xside][queen] | board.b[xside][bishop])) return (true); - - /* Rank / file */ - if (dir >= 4 && + + /* Rank / file */ + if (dir >= 4 && BitPosArray[sq1] & (board.b[xside][queen] | board.b[xside][rook])) return (true); diff --git a/src/frontend/cmd.cc b/src/frontend/cmd.cc index 742e4a4..a365afb 100644 --- a/src/frontend/cmd.cc +++ b/src/frontend/cmd.cc @@ -271,7 +271,7 @@ void cmd_level(void) TimeLimit[white] = TimeLimit[black] = TCTime * 60; if (!(flags & XBOARD)) { /* TRANSLATORS: Please be aware that the word 'move' is sometimes - used as a synonym of 'ply', and sometimes in the sense of a + used as a synonym of 'ply', and sometimes in the sense of a full 2-ply move. */ printf (_("Time Control: %d moves in %.2f secs\n"), MoveLimit[white], TimeLimit[white]); diff --git a/src/frontend/common.h b/src/frontend/common.h index 11db18f..bfd9ad9 100644 --- a/src/frontend/common.h +++ b/src/frontend/common.h @@ -4,7 +4,7 @@ Copyright (C) 2001-2011 Free Software Foundation, Inc. - GNU Chess is based on the two research programs + GNU Chess is based on the two research programs Cobalt by Chua Kong-Sian and Gazebo by Stuart Cracraft. This program is free software: you can redistribute it and/or modify @@ -20,7 +20,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - Contact Info: + Contact Info: address@hidden address@hidden, address@hidden, address@hidden */ @@ -43,8 +43,8 @@ #include #include - /* - * Define time structures to get timeval for Timer + /* + * Define time structures to get timeval for Timer */ #include @@ -77,7 +77,7 @@ typedef uint32_t KeyType; * simplify analysis: */ -typedef struct +typedef struct { BitBoard b[2][7]; /* piece/pawn positions by side (0=white, 1=black) and then by piece (1=pawn..6=king). For example, @@ -95,7 +95,7 @@ typedef struct short pmaterial[2]; /* Total pawn material by side not inc. king */ short castled[2]; /* True (1) if side is castled */ short king[2]; /* Location of king 0 - a1 .. 63 - h8 */ -} Board; +} Board; /* leaf describes a leaf-level analysis result */ @@ -165,7 +165,7 @@ typedef struct /* Some bit macros */ /* - * gcc 2.95.4 completely screws up the macros with lookup tables + * gcc 2.95.4 completely screws up the macros with lookup tables * with -O2 on PPC, maybe this check has to be refined. (I don't know * whether other architectures also suffer from this gcc bug.) However, * with gcc 3.0, the lookup tables are _much_ faster than this direct @@ -200,18 +200,18 @@ typedef struct /* constants for move description */ #define KNIGHTPRM 0x00002000 -#define BISHOPPRM 0x00003000 +#define BISHOPPRM 0x00003000 #define ROOKPRM 0x00004000 #define QUEENPRM 0x00005000 #define PROMOTION 0x00007000 #define PAWNCAP 0x00008000 -#define KNIGHTCAP 0x00010000 +#define KNIGHTCAP 0x00010000 #define BISHOPCAP 0x00018000 -#define ROOKCAP 0x00020000 -#define QUEENCAP 0x00028000 -#define CAPTURE 0x00038000 -#define NULLMOVE 0x00100000 -#define CASTLING 0x00200000 +#define ROOKCAP 0x00020000 +#define QUEENCAP 0x00028000 +#define CAPTURE 0x00038000 +#define NULLMOVE 0x00100000 +#define CASTLING 0x00200000 #define ENPASSANT 0x00400000 #define MOVEMASK (CASTLING | ENPASSANT | PROMOTION | 0x0FFF) @@ -233,7 +233,7 @@ typedef struct #define BCASTLE (BKINGCASTLE | BQUEENCASTLE) /* Material values */ -#define ValueP 100 +#define ValueP 100 #define ValueN 350 #define ValueB 350 #define ValueR 550 @@ -297,8 +297,8 @@ extern BitBoard FromToRay[64][64]; extern BitBoard RankBit[8]; extern BitBoard FileBit[8]; extern BitBoard Ataks[2][7]; -extern BitBoard Rook00Atak[64][256]; -extern BitBoard Rook90Atak[64][256]; +extern BitBoard Rook00Atak[64][256]; +extern BitBoard Rook90Atak[64][256]; extern BitBoard Bishop45Atak[64][256]; extern BitBoard Bishop315Atak[64][256]; extern short directions[64][64]; @@ -477,8 +477,8 @@ void Solve (char *); /* Player database */ void DBSortPlayer (const char *style); -void DBListPlayer (const char *style); -void DBReadPlayer (void); +void DBListPlayer (const char *style); +void DBReadPlayer (void); void DBWritePlayer (void); int DBSearchPlayer (const char *player); void DBUpdatePlayer (const char *player, const char *resultstr); @@ -495,7 +495,7 @@ void parse_input(void); void check_board(void); /* Commands from the input engine */ -void cmd_activate(void); +void cmd_activate(void); void cmd_analyze(void); void cmd_bk(void); void cmd_black(void); @@ -504,7 +504,7 @@ void cmd_computer(void); void cmd_depth(void); void cmd_draw(void); void cmd_easy(void); -void cmd_edit(void); +void cmd_edit(void); void cmd_epd(void); void cmd_exit(void); void cmd_force(void); @@ -545,7 +545,7 @@ void cmd_save(void); void cmd_setboard(void); void cmd_show (void); void cmd_solve(void); -void cmd_st(void); +void cmd_st(void); void cmd_switch(void); void cmd_test (void); void cmd_time(void); @@ -623,8 +623,8 @@ int ReadFromEngine( void ); void SetDataToEngine( const char data[] ); /* - * Stores in a global flag variable whether an answer is expected from - * the engine (1) or not (0). + * Stores in a global flag variable whether an answer is expected from + * the engine (1) or not (0). */ void ExpectAnswerFromEngine( int ); @@ -641,12 +641,12 @@ void NextUserCmd( void ); /* * Extracts a command from the engine input buffer. - */ + */ void NextEngineCmd( void ); /* * Stores in a global flag variable whether an input from the user is a - * valid move (1) or not (0). + * valid move (1) or not (0). */ void SetUserInputValidMove( int valid ); @@ -656,7 +656,7 @@ void SetUserInputValidMove( int valid ); void ChangeColor( int change ); /* - * Sets the autoGo flag, meaning that after a user move a go command will be + * Sets the autoGo flag, meaning that after a user move a go command will be * sent to the engine. This may be necessary after an undo. */ void SetAutoGo( int go ); diff --git a/src/frontend/debug.cc b/src/frontend/debug.cc index 2d31900..f7df145 100644 --- a/src/frontend/debug.cc +++ b/src/frontend/debug.cc @@ -4,7 +4,7 @@ Copyright (C) 2001-2014 Free Software Foundation, Inc. - GNU Chess is based on the two research programs + GNU Chess is based on the two research programs Cobalt by Chua Kong-Sian and Gazebo by Stuart Cracraft. This program is free software: you can redistribute it and/or modify @@ -20,7 +20,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - Contact Info: + Contact Info: address@hidden address@hidden, address@hidden, address@hidden */ @@ -47,7 +47,7 @@ int dbg_open(const char *name) { int flags = O_WRONLY | O_CREAT | O_APPEND; int mode = 0777; - + if (name == NULL) { debug_fd = open(DEBUG_FILENAME, flags, mode); } else { @@ -76,7 +76,7 @@ int dbg_printf(const char *fmt, ...) va_list ap; char buf[MAX_DEBUG]; struct timeval tv; - + gettimeofday(&tv, NULL); #ifdef __APPLE__ sprintf(buf, "%010ld.%06d: ", tv.tv_sec, tv.tv_usec); diff --git a/src/frontend/engine.cc b/src/frontend/engine.cc index ff61a54..5d5f198 100644 --- a/src/frontend/engine.cc +++ b/src/frontend/engine.cc @@ -4,7 +4,7 @@ Copyright (C) 2001-2011 Free Software Foundation, Inc. - GNU Chess is based on the two research programs + GNU Chess is based on the two research programs Cobalt by Chua Kong-Sian and Gazebo by Stuart Cracraft. This program is free software: you can redistribute it and/or modify @@ -20,7 +20,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - Contact Info: + Contact Info: address@hidden address@hidden, address@hidden, address@hidden */ @@ -71,7 +71,7 @@ static int autoGo=false; * Forward declaration of functions */ -int SendToEngine( char msg[] ); +int SendToEngine( char msg[] ); static int GetNextLine( char buf[], char line[] ); static int GetDataToEngine( char data[] ); static int AnswerFromEngineExpected( void ); @@ -102,9 +102,9 @@ int SendToEngine( char msg[] ) the new message. TODO: This should be improved. */ msg[msg_size] = '\n'; msg[msg_size+1] = '\0'; - + msg_count = write( pipefd_f2a[1], msg, msg_size+1 ); - + if (msg_count == -1) outError = errno; else @@ -140,7 +140,7 @@ int ReadFromEngine( void ) time_val->tv_sec = 0; time_val->tv_usec = 0; engineinputready = select( pipefd_a2f[0]+1, set, NULL, NULL, time_val ); - + if ( engineinputready == -1 ) { printf( "Error reading engine input.\n" ); } else if ( engineinputready > 0 ) { @@ -149,7 +149,7 @@ int ReadFromEngine( void ) nread = read( pipefd_a2f[0], engineinputaux, BUF_SIZE ); /*write( STDOUT_FILENO, engineinputaux, BUF_SIZE );*/ strcat( engineinputbuf, engineinputaux ); - engineinputbuf[strlen( engineinputbuf ) + nread] = '\0'; + engineinputbuf[strlen( engineinputbuf ) + nread] = '\0'; } return ( engineinputready ); @@ -175,7 +175,7 @@ void ReadFromUser( void ) time_val->tv_sec = 0; time_val->tv_usec = 0; userinputready = select( STDIN_FILENO+1, set, NULL, NULL, time_val ); - + if ( userinputready == -1 ) { printf( "Error reading user input.\n" ); } else if ( userinputready > 0 ) { @@ -183,7 +183,7 @@ void ReadFromUser( void ) strncpy( userinputaux, zerochar, BUF_SIZE ); nread = read( STDIN_FILENO, userinputaux, BUF_SIZE ); strcat( userinputbuf, userinputaux ); - userinputbuf[strlen( userinputbuf ) + nread] = '\0'; + userinputbuf[strlen( userinputbuf ) + nread] = '\0'; } } @@ -194,10 +194,10 @@ void SetDataToEngine( const char data[] ) { strcpy( dataToEngine, data ); } - + /* * Writes in the (output) parameter the data that must be sent to the engine. - * + * * Return value: * 1 - if there are some data to be sent * 0 - if there are no data to be sent @@ -214,8 +214,8 @@ static int GetDataToEngine( char data[] ) } /* - * Stores in a global flag variable whether an answer is expected from - * the engine (1) or not (0). + * Stores in a global flag variable whether an answer is expected from + * the engine (1) or not (0). */ void ExpectAnswerFromEngine( int answerExpected ) { @@ -240,8 +240,8 @@ void ShowPrompt( void ) { char prompt[MAXSTR] = ""; if ( showprompt && !(flags & XBOARD) ) { - sprintf(prompt,"%s (%d) : ", - RealSide ? "Black" : "White", + sprintf(prompt,"%s (%d) : ", + RealSide ? "Black" : "White", (RealGameCnt+1)/2 + 1 ); fprintf( stdout, "%s", prompt ); fflush( stdout ); @@ -251,7 +251,7 @@ void ShowPrompt( void ) /* * Extracts a command from the user input buffer. - * + * * The command is removed from the buffer. * If the command must be sent to the engine, it is sent. * This function relies on parse_input(). @@ -259,7 +259,7 @@ void ShowPrompt( void ) void NextUserCmd( void ) { char userinput[BUF_SIZE]=""; - + if ( strlen( userinputbuf ) > 0 ) { printf("TimeLimit[0] = %g\n", TimeLimit[0]); printf("TimeLimit[1] = %g\n", TimeLimit[1]); @@ -293,12 +293,12 @@ void NextUserCmd( void ) RealSide = board.side; } } - } + } } /* * Extracts a command from the engine input buffer. - * + * * The command is removed from the buffer. * If the command is a move, the move is made. */ @@ -307,7 +307,7 @@ void NextEngineCmd( void ) char engineinput[BUF_SIZE]=""; char enginemovestr[BUF_SIZE]=""; leaf* enginemove; - + if ( strlen( engineinputbuf ) > 0 ) { if ( GetNextLine( engineinputbuf, engineinput ) > 0 ) { dbg_printf("< ENGINE: %s\n", engineinput); @@ -319,7 +319,7 @@ void NextEngineCmd( void ) dbg_printf( "Bad move from engine\n" ); } else { dbg_printf( "Engine move: <%s> (%d,%d)\n", enginemovestr, - (enginemove!=NULL ? enginemove->move : -1), + (enginemove!=NULL ? enginemove->move : -1), (enginemove!=NULL ? enginemove->score : -1) ); SANMove (enginemove->move, 1); MakeMove( board.side, &(enginemove->move) ); @@ -358,7 +358,7 @@ void NextEngineCmd( void ) /* * Stores in a global flag variable whether an input from the user is a - * valid move (1) or not (0). + * valid move (1) or not (0). */ void SetUserInputValidMove( int valid ) { @@ -377,7 +377,7 @@ static int UserInputIsAValidMove(void) /* * Extracts a line from 'buf' and copies it to 'line'. - * + * * The end-of-line character is also copied. */ static int GetNextLine( char buf[], char line[] ) @@ -406,7 +406,7 @@ static int GetNextLine( char buf[], char line[] ) * Gets a line from 'buf' and copies it to 'line'. * Unlike GetNextLine, it will not remove the line from the * original buffer. - * + * * The end-of-line character is also copied. */ static int GetNextLineNoRemove( char buf[], char line[] ) @@ -434,7 +434,7 @@ void ChangeColor( int change ) } /* - * Sets the autoGo flag, meaning that after a user move a go command will be + * Sets the autoGo flag, meaning that after a user move a go command will be * sent to the engine. This may be necessary after an undo. */ void SetAutoGo( int go ) @@ -510,7 +510,7 @@ void ForwardUserInputToEngine( void ) time_val->tv_sec = 0; time_val->tv_usec = 0; userinputready = select( STDIN_FILENO+1, set, NULL, NULL, time_val ); - + if ( userinputready == -1 ) { printf( "Error reading user input.\n" ); } else if ( userinputready > 0 ) { @@ -554,7 +554,7 @@ void ForwardEngineOutputToUser( void ) time_val->tv_sec = 0; time_val->tv_usec = 0; engineinputready = select( pipefd_e2a[0]+1, set, NULL, NULL, time_val ); - + if ( engineinputready == -1 ) { printf( "Error reading engine input.\n" ); } else if ( engineinputready > 0 ) { diff --git a/src/frontend/epd.cc b/src/frontend/epd.cc index e07bb85..9a80f69 100644 --- a/src/frontend/epd.cc +++ b/src/frontend/epd.cc @@ -4,7 +4,7 @@ Copyright (C) 2001-2011 Free Software Foundation, Inc. - GNU Chess is based on the two research programs + GNU Chess is based on the two research programs Cobalt by Chua Kong-Sian and Gazebo by Stuart Cracraft. This program is free software: you can redistribute it and/or modify @@ -20,7 +20,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - Contact Info: + Contact Info: address@hidden address@hidden, address@hidden, address@hidden */ @@ -41,8 +41,8 @@ short ReadEPDFile (const char *file, short op) * Reads in an EPD file. The first call will read the first EPD line, * the second call will read the 2nd line and so on. To improve * performance, the file is never closed. Closing of the file happens - * only on 2 conditions: (i) A ReadEPDFile failed because there is no - * more lines to read. (ii) A called to ReadEPDFile to explicitly + * only on 2 conditions: (i) A ReadEPDFile failed because there is no + * more lines to read. (ii) A called to ReadEPDFile to explicitly * request that the file is closed (op = EPDCLOSE); * If op == 2, then we work silently. * Comment lines are stripped off. Comment mark is '#'. @@ -64,8 +64,8 @@ short ReadEPDFile (const char *file, short op) } /* Is this a close request? */ - if (op == EPDCLOSE) - { + if (op == EPDCLOSE) + { fclose (fp); fp = NULL; return (false); @@ -75,7 +75,7 @@ next_line: /* Okay, we read in an EPD entry */ fgets (line, MAXSTR-1, fp); strcpy( epd_line, line ); - if (!feof(fp)) + if (!feof(fp)) { /* Skip comment lines */ int i=0; @@ -99,7 +99,7 @@ next_line: } /* finished, must close file */ else - { + { fclose (fp); fp = NULL; return (false); @@ -115,7 +115,7 @@ next_line: int ParseEPD (char *p) /************************************************************************** - * + * * Parses an EPD input line. A few global variables are updated e.g. * current board, side to move, en passant, castling status, etc. * @@ -138,71 +138,71 @@ int ParseEPD (char *p) SETBIT (board.blockerr45, r45[sq]); SETBIT (board.blockerr315, r315[sq]); board.material[white] += ValueP; - break; + break; case 'N' : SETBIT (board.b[white][knight], sq); SETBIT (board.blockerr90, r90[sq]); SETBIT (board.blockerr45, r45[sq]); SETBIT (board.blockerr315, r315[sq]); board.material[white] += ValueN; - break; + break; case 'B' : SETBIT (board.b[white][bishop], sq); SETBIT (board.blockerr90, r90[sq]); SETBIT (board.blockerr45, r45[sq]); SETBIT (board.blockerr315, r315[sq]); board.material[white] += ValueB; - break; + break; case 'R' : SETBIT (board.b[white][rook], sq); SETBIT (board.blockerr90, r90[sq]); SETBIT (board.blockerr45, r45[sq]); SETBIT (board.blockerr315, r315[sq]); board.material[white] += ValueR; - break; + break; case 'Q' : SETBIT (board.b[white][queen], sq); SETBIT (board.blockerr90, r90[sq]); SETBIT (board.blockerr45, r45[sq]); SETBIT (board.blockerr315, r315[sq]); board.material[white] += ValueQ; - break; + break; case 'K' : SETBIT (board.b[white][king], sq); SETBIT (board.blockerr90, r90[sq]); SETBIT (board.blockerr45, r45[sq]); SETBIT (board.blockerr315, r315[sq]); - break; + break; case 'p' : SETBIT (board.b[black][pawn], sq); SETBIT (board.blockerr90, r90[sq]); SETBIT (board.blockerr45, r45[sq]); SETBIT (board.blockerr315, r315[sq]); board.material[black] += ValueP; - break; + break; case 'n' : SETBIT (board.b[black][knight], sq); SETBIT (board.blockerr90, r90[sq]); SETBIT (board.blockerr45, r45[sq]); SETBIT (board.blockerr315, r315[sq]); board.material[black] += ValueN; - break; + break; case 'b' : SETBIT (board.b[black][bishop], sq); SETBIT (board.blockerr90, r90[sq]); SETBIT (board.blockerr45, r45[sq]); SETBIT (board.blockerr315, r315[sq]); board.material[black] += ValueB; - break; + break; case 'r' : SETBIT (board.b[black][rook], sq); SETBIT (board.blockerr90, r90[sq]); SETBIT (board.blockerr45, r45[sq]); SETBIT (board.blockerr315, r315[sq]); board.material[black] += ValueR; - break; + break; case 'q' : SETBIT (board.b[black][queen], sq); SETBIT (board.blockerr90, r90[sq]); SETBIT (board.blockerr45, r45[sq]); SETBIT (board.blockerr315, r315[sq]); board.material[black] += ValueQ; - break; + break; case 'k' : SETBIT (board.b[black][king], sq); SETBIT (board.blockerr90, r90[sq]); SETBIT (board.blockerr45, r45[sq]); SETBIT (board.blockerr315, r315[sq]); - break; + break; case '/' : r -= 8; c = -1; break; @@ -213,7 +213,7 @@ int ParseEPD (char *p) else c++; - /* + /* * Special case, a trailing "/" is accepted on the * end of the board settings. */ @@ -226,25 +226,25 @@ int ParseEPD (char *p) p++; } - board.pmaterial[white] = board.material[white] - + board.pmaterial[white] = board.material[white] - nbits(board.b[white][pawn]) * ValueP; - board.pmaterial[black] = board.material[black] - + board.pmaterial[black] = board.material[black] - nbits(board.b[black][pawn]) * ValueP; board.king[white] = leadz (board.b[white][king]); board.king[black] = leadz (board.b[black][king]); - UpdateFriends (); + UpdateFriends (); UpdateCBoard (); UpdateMvboard (); /* Get side to move */ if (!++p) return EPD_ERROR; - if (*p == 'w') board.side = white; + if (*p == 'w') board.side = white; else if (*p == 'b') board.side = black; else return EPD_ERROR; /* Isn't this one cute? */ if (!++p || *p != ' ' || !++p) return EPD_ERROR; - + /* Castling status */ while (p && *p != ' ') { if (*p == 'K') board.flag |= WKINGCASTLE; @@ -279,7 +279,7 @@ int ParseEPD (char *p) /* Read in best move; "bm" operator */ str_p = strstr(p, "bm"); - if (str_p) sscanf (str_p, "bm %63[^;];", solution); + if (str_p) sscanf (str_p, "bm %63[^;];", solution); /* Read in the description; "id" operator */ str_p = strstr(p, "id"); @@ -293,7 +293,7 @@ int ParseEPD (char *p) void LoadEPD (char *p) /************************************************************************** - * + * * This routine reads in the next or the Nth position in the file. * **************************************************************************/ @@ -307,14 +307,14 @@ void LoadEPD (char *p) ReadEPDFile (file, 0); } else - { + { ReadEPDFile (file, 1); while (--N) { if (ReadEPDFile (file, 2) == false) { printf ("File position exceeded\n"); - return; + return; } } ReadEPDFile (file, 0); @@ -326,7 +326,7 @@ void LoadEPD (char *p) void SaveEPD (char *p) /************************************************************************** - * + * * This routine appends the current position in EPD format into a file. * **************************************************************************/ @@ -348,7 +348,7 @@ void SaveEPD (char *p) k++; else { - if (k) + if (k) fprintf (fp, "%1d", k); k = 0; c1 = notation[cboard[sq]]; diff --git a/src/frontend/genmove.cc b/src/frontend/genmove.cc index 0111aef..abaca7a 100644 --- a/src/frontend/genmove.cc +++ b/src/frontend/genmove.cc @@ -4,7 +4,7 @@ Copyright (C) 2001-2011 Free Software Foundation, Inc. - GNU Chess is based on the two research programs + GNU Chess is based on the two research programs Cobalt by Chua Kong-Sian and Gazebo by Stuart Cracraft. This program is free software: you can redistribute it and/or modify @@ -20,7 +20,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - Contact Info: + Contact Info: address@hidden address@hidden, address@hidden, address@hidden */ @@ -201,7 +201,7 @@ void GenMoves (short ply) /* Black pawn forward moves */ if (side == black) { - c = (a[pawn] << 8) & notblocker; + c = (a[pawn] << 8) & notblocker; while (c) { t = leadz (c); @@ -268,28 +268,28 @@ void GenMoves (short ply) /* Castling code */ b = board.b[side][rook]; if (side == white && (board.flag & WKINGCASTLE) && (b & BitPosArray[H1]) && - !(FromToRay[E1][G1] & blocker) && + !(FromToRay[E1][G1] & blocker) && !SqAtakd (E1, black) && !SqAtakd (F1, black) && !SqAtakd (G1, black)) { - ADDMOVE (E1, G1, CASTLING); + ADDMOVE (E1, G1, CASTLING); } if (side == white && (board.flag & WQUEENCASTLE) && (b & BitPosArray[A1]) && !(FromToRay[E1][B1] & blocker) && !SqAtakd (E1, black) && !SqAtakd (D1, black) && !SqAtakd (C1, black)) { - ADDMOVE (E1, C1, CASTLING); + ADDMOVE (E1, C1, CASTLING); } if (side == black && (board.flag & BKINGCASTLE) && (b & BitPosArray[H8]) && !(FromToRay[E8][G8] & blocker) && !SqAtakd (E8, white) && !SqAtakd (F8, white) && !SqAtakd (G8, white)) { - ADDMOVE (E8, G8, CASTLING); + ADDMOVE (E8, G8, CASTLING); } if (side == black && (board.flag & BQUEENCASTLE) && (b & BitPosArray[A8]) && !(FromToRay[E8][B8] & blocker) && !SqAtakd (E8, white) && !SqAtakd (D8, white) && !SqAtakd (C8, white)) { - ADDMOVE (E8, C8, CASTLING); + ADDMOVE (E8, C8, CASTLING); } /* Update tree pointers and count */ @@ -389,7 +389,7 @@ void GenNonCaptures (short ply) /* Black pawn forward moves */ if (side == black) { - c = (a[pawn] << 8) & notblocker; + c = (a[pawn] << 8) & notblocker; while (c) { t = leadz (c); @@ -415,25 +415,25 @@ void GenNonCaptures (short ply) !(FromToRay[4][6] & blocker) && !SqAtakd (4, black) && !SqAtakd (5, black) && !SqAtakd (6, black)) { - ADDMOVE (4, 6, CASTLING); + ADDMOVE (4, 6, CASTLING); } if (side == white && (board.flag & WQUEENCASTLE) && (b & BitPosArray[0]) && !(FromToRay[4][1] & blocker) && !SqAtakd (4, black) && !SqAtakd (3, black) && !SqAtakd (2, black)) { - ADDMOVE (4, 2, CASTLING); + ADDMOVE (4, 2, CASTLING); } if (side == black && (board.flag & BKINGCASTLE) && (b & BitPosArray[63]) && !(FromToRay[60][62] & blocker) && !SqAtakd (60, white) && !SqAtakd (61, white) && !SqAtakd (62, white)) { - ADDMOVE (60, 62, CASTLING); + ADDMOVE (60, 62, CASTLING); } if (side == black && (board.flag & BQUEENCASTLE) && (b & BitPosArray[56]) && !(FromToRay[60][57] & blocker) && !SqAtakd (60, white) && !SqAtakd (59, white) && !SqAtakd (58, white)) { - ADDMOVE (60, 58, CASTLING); + ADDMOVE (60, 58, CASTLING); } /* Update tree pointers and count */ @@ -563,7 +563,7 @@ void GenCaptures (short ply) if (side == black) { b = a[pawn] & RankBit[1]; /* all pawns on 2nd rank */ - c = (b << 8) & ~blocker; + c = (b << 8) & ~blocker; while (c) { t = leadz (c); @@ -623,7 +623,7 @@ void GenCheckEscapes (short ply) /************************************************************************** * * The king is in check, so generate only moves which get the king out - * of check. + * of check. * Caveat: The special case of an enpassant capture must be taken into * account too as the captured pawn could be the checking piece. * @@ -631,7 +631,7 @@ void GenCheckEscapes (short ply) { int side, xside; int kingsq, chksq, sq, sq1, epsq, dir; - BitBoard checkers, b, c, p, escapes; + BitBoard checkers, b, c, p, escapes; escapes = NULLBITBOARD; side = board.side; xside = 1 ^ side; @@ -645,7 +645,7 @@ void GenCheckEscapes (short ply) { /* Captures of checking pieces (except by king) */ chksq = leadz (checkers); - b = AttackTo (chksq, side); + b = AttackTo (chksq, side); b &= ~board.b[side][king]; while (b) { @@ -687,23 +687,23 @@ void GenCheckEscapes (short ply) { sq = leadz (c); CLEARBIT (c, sq); - b = AttackTo (sq, side); + b = AttackTo (sq, side); b &= ~(board.b[side][king] | p); /* Add in pawn advances */ if (side == white && sq > H2) { - if (BitPosArray[sq-8] & p) + if (BitPosArray[sq-8] & p) b |= BitPosArray[sq-8]; - if (RANK(sq) == 3 && cboard[sq-8] == empty && + if (RANK(sq) == 3 && cboard[sq-8] == empty && (BitPosArray[sq-16] & p)) b |= BitPosArray[sq-16]; } if (side == black && sq < H7) { - if (BitPosArray[sq+8] & p) + if (BitPosArray[sq+8] & p) b |= BitPosArray[sq+8]; - if (RANK(sq) == 4 && cboard[sq+8] == empty && + if (RANK(sq) == 4 && cboard[sq+8] == empty && (BitPosArray[sq+16] & p)) b |= BitPosArray[sq+16]; } @@ -769,17 +769,17 @@ void FilterIllegalMoves (short ply) { MakeMove (side, &p->move); if (cboard[TOSQ(p->move)] != king) - check = SqAtakd (sq, xside); - else - check = SqAtakd (TOSQ(p->move), xside); + check = SqAtakd (sq, xside); + else + check = SqAtakd (TOSQ(p->move), xside); UnmakeMove (xside, &p->move); if (check) /* its an illegal move */ { --TreePtr[ply+1]; *p = *TreePtr[ply+1]; - --p; + --p; GenCnt--; - } + } } } diff --git a/src/frontend/init.cc b/src/frontend/init.cc index 3960162..7e9a127 100644 --- a/src/frontend/init.cc +++ b/src/frontend/init.cc @@ -4,7 +4,7 @@ Copyright (C) 2001-2011 Free Software Foundation, Inc. - GNU Chess is based on the two research programs + GNU Chess is based on the two research programs Cobalt by Chua Kong-Sian and Gazebo by Stuart Cracraft. This program is free software: you can redistribute it and/or modify @@ -20,7 +20,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - Contact Info: + Contact Info: address@hidden address@hidden, address@hidden, address@hidden */ @@ -45,7 +45,7 @@ void Initialize (void) InitBitPosArray (); InitMoveArray (); InitRay (); - InitFromToRay (); + InitFromToRay (); InitRankFileBit (); InitBitCount (); InitRotAtak (); @@ -81,9 +81,9 @@ void InitLzArray (void) void InitBitPosArray (void) /*************************************************************************** * - * BitPosArray[i] returns the bitboard whose ith bit is set to 1 + * BitPosArray[i] returns the bitboard whose ith bit is set to 1 * and every other bits 0. This ought to be faster than doing - * shifting all the time (I think). + * shifting all the time (I think). * Also compute the NotBitPosArray = ~BitPosArray. * ***************************************************************************/ @@ -91,14 +91,14 @@ void InitBitPosArray (void) BitBoard b; int i; - b = (BitBoard) 1; + b = (BitBoard) 1; for (i = 63; i >= 0; i--, b <<= 1) { BitPosArray[i] = b; NotBitPosArray[i] = ~b; } } - + /* Data used for generating MoveArray */ @@ -114,7 +114,7 @@ static const int dir[8][8] = { -11, -10, -9, -1, 1, 9, 10, 11 }, { -9, -11, 0, 0, 0, 0, 0, 0 } }; -static const int ndir[8] = +static const int ndir[8] = { 0, 2, 8, 4, 4, 8, 8, 2 }; static const int map[120] = @@ -130,13 +130,13 @@ static const int map[120] = -1, 48, 49, 50, 51, 52, 53, 54, 55, -1, -1, 56, 57, 58, 59, 60, 61, 62, 63, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; void InitMoveArray (void) /*************************************************************************** - * + * * Generate the move bitboards. For e.g. the bitboard for all * the moves of a knight on f3 is given by MoveArray[knight][21]. * @@ -170,8 +170,8 @@ void InitMoveArray (void) void InitRay (void) /************************************************************************** * - * For each square, there are 8 rays. The first 4 rays are diagonals - * for the bishops and the next 4 are file/rank for the rooks. + * For each square, there are 8 rays. The first 4 rays are diagonals + * for the bishops and the next 4 are file/rank for the rooks. * The queen uses all 8 rays. * These rays are used for move generation rather than MoveArray[]. * Also initialize the directions[][] array. directions[f][t] returns @@ -234,7 +234,7 @@ void InitFromToRay (void) do { b = &FromToRay[f][t]; - tsq += dir[piece][n]; + tsq += dir[piece][n]; if ((t = map[tsq]) != -1) { SETBIT (FromToRay[f][t], t); @@ -265,7 +265,7 @@ void InitRankFileBit (void) RankBit[i] = b; b <<= 8; } - + i = 8; b = ULL(0x0101010101010101); while (i--) @@ -286,17 +286,17 @@ void InitBitCount (void) **************************************************************************/ { int i, j, n; - + BitCount[0] = 0; - BitCount[1] = 1; + BitCount[1] = 1; i = 1; for (n = 2; n <= 16; n++) { i <<= 1; - for (j = i; j <= i + (i-1); j++) - BitCount[j] = 1 + BitCount[j - i]; + for (j = i; j <= i + (i-1); j++) + BitCount[j] = 1 + BitCount[j - i]; } -} +} void InitRotAtak (void) @@ -312,7 +312,7 @@ void InitRotAtak (void) int rot1[8] = { A1, A2, A3, A4, A5, A6, A7, A8 }; int rot2[8] = { A1, B2, C3, D4, E5, F6, G7, H8 }; int rot3[8] = { A8, B7, C6, D5, E4, F3, G2, H1 }; - + for (sq = A1; sq <= H1; sq++) { for (map = 0; map < 256; map++) @@ -332,10 +332,10 @@ void InitRotAtak (void) if (cmap[++sq2] & map) break; } - Rook00Atak[sq][map] = + Rook00Atak[sq][map] = FromToRay[sq][sq1] | FromToRay[sq][sq2]; Rook90Atak[rot1[sq]][map] = - FromToRay[rot1[sq]][rot1[sq1]] | + FromToRay[rot1[sq]][rot1[sq1]] | FromToRay[rot1[sq]][rot1[sq2]]; Bishop45Atak[rot2[sq]][map] = FromToRay[rot2[sq]][rot2[sq1]] | @@ -344,7 +344,7 @@ void InitRotAtak (void) FromToRay[rot3[sq]][rot3[sq1]] | FromToRay[rot3[sq]][rot3[sq2]]; } - } + } for (map = 0; map < 256; map++) { @@ -373,7 +373,7 @@ void InitRotAtak (void) { for (sq = sq1; sq <= sq2; sq += 9) { - Bishop45Atak[sq][map] = + Bishop45Atak[sq][map] = (Bishop45Atak[sq+1][map] & NotBitPosArray[sq1-8]) << 1; } } @@ -389,7 +389,7 @@ void InitRotAtak (void) { for (sq = sq1; sq <= sq2; sq += 7) { - Bishop315Atak[sq][map] = + Bishop315Atak[sq][map] = (Bishop315Atak[sq+1][map] & NotBitPosArray[sq2+8]) << 1; } } @@ -450,7 +450,7 @@ void InitVars (void) pgn_event = pgn_site = pgn_date = pgn_round = pgn_white = pgn_black = pgn_whiteELO = pgn_blackELO = pgn_result = - pgn_othertags = NULL; + pgn_othertags = NULL; UpdateFriends (); diff --git a/src/frontend/inlines.h b/src/frontend/inlines.h index 1638007..0057f5b 100644 --- a/src/frontend/inlines.h +++ b/src/frontend/inlines.h @@ -7,7 +7,7 @@ Copyright (C) 2001-2011 Free Software Foundation, Inc. - GNU Chess is based on the two research programs + GNU Chess is based on the two research programs Cobalt by Chua Kong-Sian and Gazebo by Stuart Cracraft. This program is free software: you can redistribute it and/or modify @@ -23,7 +23,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - Contact Info: + Contact Info: address@hidden address@hidden, address@hidden, address@hidden */ diff --git a/src/frontend/lexpgn.cc b/src/frontend/lexpgn.cc index e5e37ff..7aa746f 100644 --- a/src/frontend/lexpgn.cc +++ b/src/frontend/lexpgn.cc @@ -33,7 +33,7 @@ #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, - * if you want the limit (max/min) macros for int types. + * if you want the limit (max/min) macros for int types. */ #ifndef __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS 1 @@ -50,7 +50,7 @@ typedef uint32_t flex_uint32_t; typedef signed char flex_int8_t; typedef short int flex_int16_t; typedef int flex_int32_t; -typedef unsigned char flex_uint8_t; +typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; #endif /* ! C99 */ @@ -166,7 +166,7 @@ extern FILE *yyin, *yyout; #define EOB_ACT_LAST_MATCH 2 #define YY_LESS_LINENO(n) - + /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ do \ @@ -223,7 +223,7 @@ struct yy_buffer_state int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ - + /* Whether to try to fill the input buffer when we reach the * end of it. */ @@ -2129,7 +2129,7 @@ char *yytext; Copyright (C) 2001-2011 Free Software Foundation, Inc. - GNU Chess is based on the two research programs + GNU Chess is based on the two research programs Cobalt by Chua Kong-Sian and Gazebo by Stuart Cracraft. This program is free software: you can redistribute it and/or modify @@ -2145,7 +2145,7 @@ char *yytext; You should have received a copy of the GNU General Public License along with this program. If not, see . - Contact Info: + Contact Info: address@hidden address@hidden, address@hidden, address@hidden ****************** @@ -2191,7 +2191,7 @@ char *yytext; enum tagtype { NO_TAG, EVENT_TAG, SITE_TAG, DATE_TAG, ROUND_TAG, - WHITE_TAG, BLACK_TAG, RESULT_TAG, + WHITE_TAG, BLACK_TAG, RESULT_TAG, WHITE_ELO_TAG, BLACK_ELO_TAG, WHITETITLE_TAG, BLACKTITLE_TAG, FEN_TAG, OTHER_TAG }; @@ -2200,7 +2200,7 @@ enum data_destination_t data_dest; #define yyterminate() { if ( seen_tags || seen_moves) return 1; \ return 2; } - + char *pgn_event; char *pgn_site; @@ -2326,7 +2326,7 @@ extern int yywrap (void ); #endif static void yyunput (int c,char *buf_ptr ); - + #ifndef yytext_ptr static void yy_flex_strncpy (char *,yyconst char *,int ); #endif @@ -2434,7 +2434,7 @@ YY_DECL register yy_state_type yy_current_state; register char *yy_cp, *yy_bp; register int yy_act; - + #line 153 "lexpgn.l" /* These are executed on each entry to the code */ @@ -2941,7 +2941,7 @@ case 47: /* rule 47 can match eol */ YY_RULE_SETUP #line 404 "lexpgn.l" -{ append_comment(yytext); +{ append_comment(yytext); /* We escape [ to avoid problems with unclosed RAV */ } @@ -3254,7 +3254,7 @@ static int yy_get_next_buffer (void) { register yy_state_type yy_current_state; register char *yy_cp; - + yy_current_state = (yy_start); yy_current_state += YY_AT_BOL(); @@ -3299,7 +3299,7 @@ static int yy_get_next_buffer (void) static void yyunput (int c, register char * yy_bp ) { register char *yy_cp; - + yy_cp = (yy_c_buf_p); /* undo effects of setting up yytext */ @@ -3342,7 +3342,7 @@ static int yy_get_next_buffer (void) { int c; - + *(yy_c_buf_p) = (yy_hold_char); if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) @@ -3411,12 +3411,12 @@ static int yy_get_next_buffer (void) /** Immediately switch to a different input stream. * @param input_file A readable stream. - * + * * @note This function does not reset the start condition to @c INITIAL . */ void yyrestart (FILE * input_file ) { - + if ( ! YY_CURRENT_BUFFER ){ yyensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = @@ -3429,11 +3429,11 @@ static int yy_get_next_buffer (void) /** Switch to a different input buffer. * @param new_buffer The new input buffer. - * + * */ void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) { - + /* TODO. We should be able to replace this entire function body * with * yypop_buffer_state(); @@ -3473,13 +3473,13 @@ static void yy_load_buffer_state (void) /** Allocate and initialize an input buffer state. * @param file A readable stream. * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. - * + * * @return the allocated buffer state. */ YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) { YY_BUFFER_STATE b; - + b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); @@ -3502,11 +3502,11 @@ static void yy_load_buffer_state (void) /** Destroy the buffer. * @param b a buffer created with yy_create_buffer() - * + * */ void yy_delete_buffer (YY_BUFFER_STATE b ) { - + if ( ! b ) return; @@ -3522,7 +3522,7 @@ static void yy_load_buffer_state (void) #ifndef __cplusplus extern int isatty (int ); #endif /* __cplusplus */ - + /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, * such as during a yyrestart() or at EOF. @@ -3531,7 +3531,7 @@ extern int isatty (int ); { int oerrno = errno; - + yy_flush_buffer(b ); b->yy_input_file = file; @@ -3547,13 +3547,13 @@ extern int isatty (int ); } b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; - + errno = oerrno; } /** Discard all buffered characters. On the next scan, YY_INPUT will be called. * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. - * + * */ void yy_flush_buffer (YY_BUFFER_STATE b ) { @@ -3582,7 +3582,7 @@ extern int isatty (int ); * the current state. This function will allocate the stack * if necessary. * @param new_buffer The new state. - * + * */ void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) { @@ -3612,7 +3612,7 @@ void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) /** Removes and deletes the top of the stack, if present. * The next element becomes the new top. - * + * */ void yypop_buffer_state (void) { @@ -3636,7 +3636,7 @@ void yypop_buffer_state (void) static void yyensure_buffer_stack (void) { yy_size_t num_to_alloc; - + if (!(yy_buffer_stack)) { /* First allocation is just for 2 elements, since we don't know if this @@ -3649,9 +3649,9 @@ static void yyensure_buffer_stack (void) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); - + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); - + (yy_buffer_stack_max) = num_to_alloc; (yy_buffer_stack_top) = 0; return; @@ -3679,13 +3679,13 @@ static void yyensure_buffer_stack (void) /** Setup the input buffer state to scan directly from a user-specified character buffer. * @param base the character buffer * @param size the size in bytes of the character buffer - * - * @return the newly allocated buffer state object. + * + * @return the newly allocated buffer state object. */ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) { YY_BUFFER_STATE b; - + if ( size < 2 || base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) @@ -3714,14 +3714,14 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) /** Setup the input buffer state to scan a string. The next call to yylex() will * scan from a @e copy of @a str. * @param yystr a NUL-terminated string to scan - * + * * @return the newly allocated buffer state object. * @note If you want to scan bytes that may contain NUL values, then use * yy_scan_bytes() instead. */ YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) { - + return yy_scan_bytes(yystr,strlen(yystr) ); } @@ -3729,7 +3729,7 @@ YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) * scan from a @e copy of @a bytes. * @param bytes the byte buffer to scan * @param len the number of bytes in the buffer pointed to by @a bytes. - * + * * @return the newly allocated buffer state object. */ YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len ) @@ -3737,7 +3737,7 @@ YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len YY_BUFFER_STATE b; char *buf; yy_size_t n, i; - + /* Get memory for full buffer, including space for trailing EOB's. */ n = _yybytes_len + 2; buf = (char *) yyalloc(n ); @@ -3791,16 +3791,16 @@ static void yy_fatal_error (yyconst char* msg ) /* Accessor methods (get/set functions) to struct members. */ /** Get the current line number. - * + * */ int yyget_lineno (void) { - + return yylineno; } /** Get the input stream. - * + * */ FILE *yyget_in (void) { @@ -3808,7 +3808,7 @@ FILE *yyget_in (void) } /** Get the output stream. - * + * */ FILE *yyget_out (void) { @@ -3816,7 +3816,7 @@ FILE *yyget_out (void) } /** Get the length of the current token. - * + * */ yy_size_t yyget_leng (void) { @@ -3824,7 +3824,7 @@ yy_size_t yyget_leng (void) } /** Get the current token. - * + * */ char *yyget_text (void) @@ -3834,18 +3834,18 @@ char *yyget_text (void) /** Set the current line number. * @param line_number - * + * */ void yyset_lineno (int line_number ) { - + yylineno = line_number; } /** Set the input stream. This does not discard the current * input buffer. * @param in_str A readable stream. - * + * * @see yy_switch_to_buffer */ void yyset_in (FILE * in_str ) @@ -3899,7 +3899,7 @@ static int yy_init_globals (void) /* yylex_destroy is for both reentrant and non-reentrant scanners. */ int yylex_destroy (void) { - + /* Pop the buffer stack, destroying each element. */ while(YY_CURRENT_BUFFER){ yy_delete_buffer(YY_CURRENT_BUFFER ); diff --git a/src/frontend/move.cc b/src/frontend/move.cc index 96eb1bf..b2779d9 100644 --- a/src/frontend/move.cc +++ b/src/frontend/move.cc @@ -4,7 +4,7 @@ Copyright (C) 2001-2011 Free Software Foundation, Inc. - GNU Chess is based on the two research programs + GNU Chess is based on the two research programs Cobalt by Chua Kong-Sian and Gazebo by Stuart Cracraft. This program is free software: you can redistribute it and/or modify @@ -20,7 +20,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - Contact Info: + Contact Info: address@hidden address@hidden, address@hidden, address@hidden */ @@ -39,7 +39,7 @@ void MakeMove (int side, int *move) **************************************************************************/ { BitBoard *a; - int f, t, fpiece, tpiece; + int f, t, fpiece, tpiece; int rookf, rookt, epsq, sq; int xside; GameRec *g; @@ -62,14 +62,14 @@ void MakeMove (int side, int *move) cboard[t] = fpiece; GameCnt++; g = &Game[GameCnt]; - g->epsq = board.ep; + g->epsq = board.ep; g->bflag = board.flag; g->Game50 = Game50; g->hashkey = HashKey; g->phashkey = PawnHashKey; g->mvboard = Mvboard[t]; g->comments = NULL; - Mvboard[t] = Mvboard[f]+1; + Mvboard[t] = Mvboard[f]+1; Mvboard[f] = 0; if (board.ep > -1) HashKey ^= ephash[board.ep]; @@ -96,7 +96,7 @@ void MakeMove (int side, int *move) board.pmaterial[xside] -= Value[tpiece]; } - if (*move & PROMOTION) /* Promotion */ + if (*move & PROMOTION) /* Promotion */ { SETBIT (board.b[side][PROMOTEPIECE (*move)], t); CLEARBIT (*a, t); @@ -173,7 +173,7 @@ void MakeMove (int side, int *move) HashKey ^= WKCastlehash; board.flag &= ~WKINGCASTLE; } - else if (f == A1) + else if (f == A1) { if (board.flag & WQUEENCASTLE) HashKey ^= WQCastlehash; @@ -182,13 +182,13 @@ void MakeMove (int side, int *move) } if (tpiece == rook) { - if (t == H8) + if (t == H8) { if (board.flag & BKINGCASTLE) HashKey ^= BKCastlehash; board.flag &= ~BKINGCASTLE; } - else if (t == A8) + else if (t == A8) { if (board.flag & BQUEENCASTLE) HashKey ^= BQCastlehash; @@ -208,13 +208,13 @@ void MakeMove (int side, int *move) } else if (fpiece == rook) { - if (f == H8) + if (f == H8) { if (board.flag & BKINGCASTLE) HashKey ^= BKCastlehash; board.flag &= ~BKINGCASTLE; } - else if (f == A8) + else if (f == A8) { if (board.flag & BQUEENCASTLE) HashKey ^= BQCastlehash; @@ -223,19 +223,19 @@ void MakeMove (int side, int *move) } if (tpiece == rook) { - if (t == H1) + if (t == H1) { if (board.flag & WKINGCASTLE) HashKey ^= WKCastlehash; board.flag &= ~WKINGCASTLE; } - else if (t == A1) + else if (t == A1) { if (board.flag & WQUEENCASTLE) HashKey ^= WQCastlehash; board.flag &= ~WQUEENCASTLE; } - } + } } @@ -270,7 +270,7 @@ void UnmakeMove (int side, int *move) ****************************************************************************/ { BitBoard *a; - int f, t, fpiece, cpiece; + int f, t, fpiece, cpiece; int rookf, rookt, epsq; int xside; GameRec *g; @@ -283,13 +283,13 @@ void UnmakeMove (int side, int *move) cpiece = CAPTUREPIECE (*move); a = &board.b[side][fpiece]; CLEARBIT (*a, t); - SETBIT (*a, f); - CLEARBIT (board.blockerr90, r90[t]); - SETBIT (board.blockerr90, r90[f]); - CLEARBIT (board.blockerr45, r45[t]); - SETBIT (board.blockerr45, r45[f]); - CLEARBIT (board.blockerr315, r315[t]); - SETBIT (board.blockerr315, r315[f]); + SETBIT (*a, f); + CLEARBIT (board.blockerr90, r90[t]); + SETBIT (board.blockerr90, r90[f]); + CLEARBIT (board.blockerr45, r45[t]); + SETBIT (board.blockerr45, r45[f]); + CLEARBIT (board.blockerr315, r315[t]); + SETBIT (board.blockerr315, r315[f]); cboard[f] = cboard[t]; cboard[t] = empty; g = &Game[GameCnt]; @@ -297,28 +297,28 @@ void UnmakeMove (int side, int *move) Mvboard[t] = g->mvboard; if (fpiece == king) board.king[side] = f; - + /* if capture, put back the captured piece */ if (*move & CAPTURE) { ExchCnt[side]--; - SETBIT (board.b[xside][cpiece], t); - SETBIT (board.blockerr90, r90[t]); - SETBIT (board.blockerr45, r45[t]); - SETBIT (board.blockerr315, r315[t]); - cboard[t] = cpiece; - board.material[xside] += Value[cpiece]; + SETBIT (board.b[xside][cpiece], t); + SETBIT (board.blockerr90, r90[t]); + SETBIT (board.blockerr45, r45[t]); + SETBIT (board.blockerr315, r315[t]); + cboard[t] = cpiece; + board.material[xside] += Value[cpiece]; if (cpiece != pawn) - board.pmaterial[xside] += Value[cpiece]; + board.pmaterial[xside] += Value[cpiece]; } /* Undo promotion */ if (*move & PROMOTION) { CLEARBIT (*a, f); - SETBIT (board.b[side][pawn], f); + SETBIT (board.b[side][pawn], f); cboard[f] = pawn; - board.material[side] += (ValueP - Value[PROMOTEPIECE (*move)]); + board.material[side] += (ValueP - Value[PROMOTEPIECE (*move)]); board.pmaterial[side] -= Value[PROMOTEPIECE (*move)]; } @@ -327,13 +327,13 @@ void UnmakeMove (int side, int *move) { ExchCnt[side]--; epsq = (side == white ? g->epsq - 8 : g->epsq + 8); - SETBIT (board.b[xside][pawn], epsq); - SETBIT (board.blockerr90, r90[epsq]); - SETBIT (board.blockerr45, r45[epsq]); - SETBIT (board.blockerr315, r315[epsq]); + SETBIT (board.b[xside][pawn], epsq); + SETBIT (board.blockerr90, r90[epsq]); + SETBIT (board.blockerr45, r45[epsq]); + SETBIT (board.blockerr315, r315[epsq]); cboard[epsq] = pawn; - board.material[xside] += ValueP; - } + board.material[xside] += ValueP; + } /* if castling, undo rook move */ if (*move & CASTLING) @@ -350,7 +350,7 @@ void UnmakeMove (int side, int *move) } a = &board.b[side][rook]; CLEARBIT (*a, rookt); - SETBIT (*a, rookf); + SETBIT (*a, rookf); CLEARBIT (board.blockerr90, r90[rookt]); SETBIT (board.blockerr90, r90[rookf]); CLEARBIT (board.blockerr45, r45[rookt]); @@ -367,7 +367,7 @@ void UnmakeMove (int side, int *move) UpdateFriends (); board.side = side; board.ep = g->epsq; - board.flag = g->bflag; + board.flag = g->bflag; HashKey = g->hashkey; PawnHashKey = g->phashkey; Game50 = g->Game50; @@ -404,11 +404,11 @@ void SANMove (int move, int ply) strcpy (s, "O-O-O"); return; } - + /**************************************************************************** * - * Here split the code into 2 parts for clarity sake. First part deals - * with pawn moves only, 2nd part only piece moves. However before doing + * Here split the code into 2 parts for clarity sake. First part deals + * with pawn moves only, 2nd part only piece moves. However before doing * that, see if the move is ambiguous. * ****************************************************************************/ @@ -421,7 +421,7 @@ void SANMove (int move, int ply) node1 = TreePtr[ply]; if (nbits (b) > 1) { - /* + /* * Scan the movelist to see if another same-type piece is * also moving to that particular to-square. */ @@ -467,7 +467,7 @@ void SANMove (int move, int ply) *s++ = algbrfile[ROW (f)]; } if (cboard[t] != 0) /* capture */ - *s++ = 'x'; + *s++ = 'x'; strcpy (s, algbr[t]); s += 2; } @@ -484,7 +484,7 @@ void SANMove (int move, int ply) *s++ = '+'; GenCnt -= TreePtr[ply+2] - TreePtr[ply+1]; } - UnmakeMove (1^side, &move); + UnmakeMove (1^side, &move); *s = '\0'; return; @@ -503,7 +503,7 @@ inline int piece_id(const char c) * isn't enough to handle two-character names (common in Russian text * and old English notation that used Kt), but we're not supposed to * see such text here anyway. This will - * accept "P" for pawn, and it used to accept many lowercase chars + * accept "P" for pawn, and it used to accept many lowercase chars * (but not "b" for Bishop). However, lowercase chars are no longer * accepted, since they are not allowed by the Fruit engine. */ switch (c) @@ -543,8 +543,8 @@ leaf * ValidateMove (char *s) leaf *n1, *n2; TreePtr[2] = TreePtr[1]; - GenMoves (1); - FilterIllegalMoves (1); + GenMoves (1); + FilterIllegalMoves (1); side = board.side; /************************************************************************ @@ -555,22 +555,22 @@ leaf * ValidateMove (char *s) do { if (*s != 'x' && *s != '+' && *s != '=' && !isspace(*s)) - *p++ = *s; + *p++ = *s; } while (*s++ != '\0' ); /* Flush castles that check */ if (mvstr[strlen(mvstr)-1] == '+' || mvstr[strlen(mvstr)-1] == '#' || - mvstr[strlen(mvstr)-1] == '=') mvstr[strlen(mvstr)-1] = '\000'; + mvstr[strlen(mvstr)-1] == '=') mvstr[strlen(mvstr)-1] = '\000'; /* Check for castling */ - if (strcmp (mvstr, "O-O") == 0 || strcmp (mvstr, "o-o") == 0 || + if (strcmp (mvstr, "O-O") == 0 || strcmp (mvstr, "o-o") == 0 || strcmp (mvstr, "0-0") == 0) { if (side == white) { f = 4; t = 6; } - else + else { f = 60; t = 62; } @@ -603,7 +603,7 @@ leaf * ValidateMove (char *s) /*********************************************************************** - * Its a SAN notation move. More headache! + * Its a SAN notation move. More headache! * We generate all the legal moves and start comparing them with * the input move. ***********************************************************************/ @@ -617,7 +617,7 @@ leaf * ValidateMove (char *s) if ( f > 0 && f < 64 ) { if (BitPosArray[f] & board.b[side][pawn]) { - if (mvstr[2] != '\0') + if (mvstr[2] != '\0') return (IsInMoveList (1, f, t, mvstr[2])); else return (IsInMoveList (1, f, t, ' ')); @@ -657,7 +657,7 @@ leaf * ValidateMove (char *s) f = t - (side == white ? 8 : -8) + (file - fileto); piece = (strlen (mvstr) == 3 ? mvstr[2] : ' '); return (IsInMoveList (1, f, t, piece)); - default : + default : printf ("Ambiguous move: %s %s\n",s,mvstr); ShowBoard(); /* @@ -665,9 +665,9 @@ leaf * ValidateMove (char *s) */ return ((leaf *) NULL); } - } + } - } + } else if ((piece = piece_id(mvstr[0])) != empty && (piece_id(mvstr[1]) == empty)) /* Is a piece move */ { @@ -713,7 +713,7 @@ leaf * ValidateMove (char *s) getchar(); */ return ((leaf *) NULL); - } + } else if (kount == 0) return ((leaf *) NULL); else @@ -758,12 +758,12 @@ leaf * ValidateMove (char *s) getchar(); */ return ((leaf *) NULL); - } + } else if (kount == 0) return ((leaf *) NULL); else return (n2); - + } /* Fall through. Nothing worked, return that no move was performed. */ @@ -783,7 +783,7 @@ leaf * IsInMoveList (int ply, int f, int t, char piece) for (node = TreePtr[ply]; node < TreePtr[ply + 1]; node++) { - if ((int) (node->move & 0x0FFF) == MOVE(f,t) && + if ((int) (node->move & 0x0FFF) == MOVE(f,t) && toupper(piece) == notation[PROMOTEPIECE (node->move)]) return (node); } diff --git a/src/frontend/output.cc b/src/frontend/output.cc index 0d26166..21698cb 100644 --- a/src/frontend/output.cc +++ b/src/frontend/output.cc @@ -4,7 +4,7 @@ Copyright (C) 2001-2013 Free Software Foundation, Inc. - GNU Chess is based on the two research programs + GNU Chess is based on the two research programs Cobalt by Chua Kong-Sian and Gazebo by Stuart Cracraft. This program is free software: you can redistribute it and/or modify @@ -20,7 +20,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - Contact Info: + Contact Info: address@hidden address@hidden, address@hidden, address@hidden */ @@ -75,34 +75,34 @@ void ShowTime (void) void ShowMoveList (int ply) /************************************************************************** * - * Print out the move list. + * Print out the move list. * **************************************************************************/ { leaf *node; int i = 0; - + for (node = TreePtr[ply]; node < TreePtr[ply+1]; node++) { - SANMove (node->move, ply); + SANMove (node->move, ply); printf ("%5s %3d\t", SANmv, SwapOff(node->move)); if (++i == 5) { - printf ("\n"); + printf ("\n"); i = 0; } } printf ("\n"); -} +} -void ShowSmallBoard (void) +void ShowSmallBoard (void) /***************************************************************************** * * Display the board. Not only that but display some useful information * like whether enpassant is legal and castling state. * - *****************************************************************************/ + *****************************************************************************/ { int r, c, sq; @@ -161,25 +161,25 @@ void ShowSmallBoard (void) } printf ("\n"); } - -void ShowBoard (void) + +void ShowBoard (void) /***************************************************************************** * * Display the board. Not only that but display some useful information * like whether enpassant is legal and castling state. * - *****************************************************************************/ + *****************************************************************************/ { int r, c, sq; fprintf (ofp, "\n"); if ( graphicmodeoutput == 1) { - fprintf(ofp, " "); + fprintf(ofp, " "); } - + if (board.side == white) fprintf (ofp, "white "); else @@ -201,7 +201,7 @@ void ShowBoard (void) char arr_board[MAX_BOARD_RANGE]; unsigned bIndex = 0; - memset(arr_board, '\0', MAX_BOARD_RANGE); + memset(arr_board, '\0', MAX_BOARD_RANGE); for (r = 56; r >= 0; r -= 8) { @@ -240,7 +240,7 @@ void ShowBoard (void) if ( graphicmodeoutput == 1) { ShowStylishBoard(arr_board); } else { - ShowClassicalBoard(arr_board); + ShowClassicalBoard(arr_board); } fprintf (ofp, "\n"); @@ -250,13 +250,13 @@ void ShowBoard (void) void ShowStylishBoard(const char *boardmap) { unsigned i = 0; - unsigned row = 8; - const char column[8] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'}; - int b_white = 1; - char tmp_piece[PIECE_SIZE]; - memset(tmp_piece, '\0', PIECE_SIZE); + unsigned row = 8; + const char column[8] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'}; + int b_white = 1; + char tmp_piece[PIECE_SIZE]; + memset(tmp_piece, '\0', PIECE_SIZE); - fprintf(ofp, "%d ", row--); + fprintf(ofp, "%d ", row--); for (i =0; i < MAX_BOARD_RANGE; ++i) { @@ -270,9 +270,9 @@ void ShowStylishBoard(const char *boardmap) if (row >=1) fprintf(ofp, "%d ", row--); else - break; + break; } - + GetPiece(boardmap[i], tmp_piece); if (b_white) @@ -282,10 +282,10 @@ void ShowStylishBoard(const char *boardmap) else { fprintf(ofp, "%s%s", black_square, tmp_piece); - } + } b_white = !b_white; - } + } fprintf(ofp, "%s ", default_console); @@ -324,7 +324,7 @@ void GetPiece(const char orig_piece, char *piece) strcpy(piece, w_pieces[ui_king]); else if (orig_piece == '.') strcpy(piece, blank_place); -} +} void ShowClassicalBoard(const char *boardmap) @@ -335,9 +335,9 @@ void ShowClassicalBoard(const char *boardmap) if ((i > 0) && (i % 8 == 0)) { fprintf(ofp, "\n"); } - + fprintf(ofp, "%c ", boardmap[i]); - } + } } @@ -381,7 +381,7 @@ void ShowMvboard (void) } printf ("\n"); } - + void ShowGame (void) { int i; @@ -390,29 +390,29 @@ void ShowGame (void) * We must handle the special case of an EPD * * game where the first move is by black * ********************************************* */ - + if ( GameCnt >= 0 ) { - + printf (" White Black\n"); - + if ( ( board.side == white && GameCnt % 2 == 1 ) || ( board.side == black && GameCnt % 2 == 0 )) { - + for (i = 0; i <= GameCnt; i += 2) { - printf ("%3d. %-7s %-7s\n", i/2 + 1, Game[i].SANmv, + printf ("%3d. %-7s %-7s\n", i/2 + 1, Game[i].SANmv, Game[i + 1].SANmv); } } else { - + printf (" 1. %-7s\n", Game[0].SANmv); - + for (i = 1; i <= GameCnt; i += 2) { - printf ("%3d. %-7s %-7s\n", i/2 + 2, Game[i].SANmv, + printf ("%3d. %-7s %-7s\n", i/2 + 2, Game[i].SANmv, Game[i + 1].SANmv); } } diff --git a/src/frontend/pgn.cc b/src/frontend/pgn.cc index c11c256..545c1ce 100644 --- a/src/frontend/pgn.cc +++ b/src/frontend/pgn.cc @@ -4,7 +4,7 @@ Copyright (C) 2001-2011 Free Software Foundation, Inc. - GNU Chess is based on the two research programs + GNU Chess is based on the two research programs Cobalt by Chua Kong-Sian and Gazebo by Stuart Cracraft. This program is free software: you can redistribute it and/or modify @@ -20,7 +20,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - Contact Info: + Contact Info: address@hidden address@hidden, address@hidden, address@hidden */ @@ -78,14 +78,14 @@ void PGNSaveToFile (const char *file, const char *resultstr) } fprintf (fp, "[Round \"%s\"]\n", NULL2EMPTY(pgn_round)); - if (pgn_white) + if (pgn_white) fprintf (fp, "[White \"%s\"]\n", pgn_white); - else if (computer == white) + else if (computer == white) fprintf (fp, "[White \"%s %s\"]\n",PROGRAM,VERSION); else fprintf (fp, "[White \"%s\"]\n",name); - if (pgn_black) + if (pgn_black) fprintf (fp, "[Black \"%s\"]\n", pgn_black); else if (computer == black) fprintf (fp, "[Black \"%s %s\"]\n",PROGRAM,VERSION); @@ -135,7 +135,7 @@ void PGNSaveToFile (const char *file, const char *resultstr) { p = s + 79; while (*p-- != ' '); - *++p = '\0'; + *++p = '\0'; fprintf (fp, "%s\n", s); strcpy (s, p+1); } @@ -153,7 +153,7 @@ void PGNSaveToFile (const char *file, const char *resultstr) fprintf (fp, "\n\n"); fclose (fp); -} +} void PGNReadFromFile (const char *file, int showheading) @@ -172,7 +172,7 @@ void PGNReadFromFile (const char *file, int showheading) return; } yyin = fp; - + InitVars (); data_dest = DEST_GAME; @@ -184,16 +184,16 @@ void PGNReadFromFile (const char *file, int showheading) if ( showheading ) { printf("\n--------------------------------------------------\n"); - printf("%s (%s) x %s (%s) - %s\nSite: %s\nDate: %s\n", + printf("%s (%s) x %s (%s) - %s\nSite: %s\nDate: %s\n", pgn_white != NULL ? pgn_white : "Unknown", pgn_whiteELO != NULL ? pgn_whiteELO : "Unknown", pgn_black != NULL ? pgn_black : "Unknown", pgn_blackELO != NULL ? pgn_blackELO : "Unknown", - pgn_result != NULL ? pgn_result : "Unknown", pgn_site != NULL ? pgn_site : "Unknown", + pgn_result != NULL ? pgn_result : "Unknown", pgn_site != NULL ? pgn_site : "Unknown", pgn_date != NULL ? pgn_date : "Unknown"); printf("--------------------------------------------------\n"); } } -/* Only players in the table below are permitted into the opening book +/* Only players in the table below are permitted into the opening book from the PGN files. Please expand the table as needed. Generally, I would recommend only acknowledged GM's and IM's and oneself, but because of the self-changing nature of the book, anything inferior diff --git a/src/frontend/players.cc b/src/frontend/players.cc index 59a4758..5aae853 100644 --- a/src/frontend/players.cc +++ b/src/frontend/players.cc @@ -4,7 +4,7 @@ Copyright (C) 2001-2011 Free Software Foundation, Inc. - GNU Chess is based on the two research programs + GNU Chess is based on the two research programs Cobalt by Chua Kong-Sian and Gazebo by Stuart Cracraft. This program is free software: you can redistribute it and/or modify @@ -20,7 +20,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - Contact Info: + Contact Info: address@hidden address@hidden, address@hidden, address@hidden */ @@ -50,7 +50,7 @@ static char lname[MAXNAMESZ]; static int rscorecompare(const void *aa, const void *bb) { const playerentry *a = (const playerentry *)aa; - const playerentry *b = (const playerentry *)bb; + const playerentry *b = (const playerentry *)bb; float ascore, bscore; ascore = (a->wins+(a->draws/2))/(a->wins+a->draws+a->losses); bscore = (b->wins+(b->draws/2))/(b->wins+b->draws+b->losses); @@ -62,7 +62,7 @@ static int rscorecompare(const void *aa, const void *bb) static int scorecompare(const void *aa, const void *bb) { const playerentry *a = (const playerentry *)aa; - const playerentry *b = (const playerentry *)bb; + const playerentry *b = (const playerentry *)bb; int ascore, bscore; ascore = 100*(a->wins+(a->draws/2))/(a->wins+a->draws+a->losses); bscore = 100*(b->wins+(b->draws/2))/(b->wins+b->draws+b->losses); @@ -74,7 +74,7 @@ static int scorecompare(const void *aa, const void *bb) static int namecompare(const void *aa, const void *bb) { const playerentry *a = (const playerentry *)aa; - const playerentry *b = (const playerentry *)bb; + const playerentry *b = (const playerentry *)bb; if (strcmp(a->player,b->player) > 0) return(1); else if (strcmp(a->player,b->player) < 0) return(-1); else return(0); @@ -94,7 +94,7 @@ void DBSortPlayer (const char *style) void DBListPlayer (const char *style) { int i; - + DBReadPlayer (); DBSortPlayer (style); for (i = 0; i < totalplayers; i++) { @@ -175,7 +175,7 @@ void DBUpdatePlayer (const char *player, const char *resultstr) x = lname; strcpy(lname,player); do { - if (*p != ' ') + if (*p != ' ') *x++ = *p++; else p++; diff --git a/src/frontend/solve.cc b/src/frontend/solve.cc index 50bf4f1..595a5fd 100644 --- a/src/frontend/solve.cc +++ b/src/frontend/solve.cc @@ -4,7 +4,7 @@ Copyright (C) 2001-2011 Free Software Foundation, Inc. - GNU Chess is based on the two research programs + GNU Chess is based on the two research programs Cobalt by Chua Kong-Sian and Gazebo by Stuart Cracraft. This program is free software: you can redistribute it and/or modify @@ -20,7 +20,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - Contact Info: + Contact Info: address@hidden address@hidden, address@hidden, address@hidden */ @@ -48,12 +48,12 @@ void Solve (char *file) int elo; total = correct = 0; - SET (flags, SOLVE); + SET (flags, SOLVE); while (ReadEPDFile (file, 0)) { NewPosition (); total++; - ShowBoard (); + ShowBoard (); SolvePosition( myMove, epd_line ); p = solution; found = false; diff --git a/src/frontend/swap.cc b/src/frontend/swap.cc index 7fc1838..669e92f 100644 --- a/src/frontend/swap.cc +++ b/src/frontend/swap.cc @@ -4,7 +4,7 @@ Copyright (C) 2001-2011 Free Software Foundation, Inc. - GNU Chess is based on the two research programs + GNU Chess is based on the two research programs Cobalt by Chua Kong-Sian and Gazebo by Stuart Cracraft. This program is free software: you can redistribute it and/or modify @@ -20,7 +20,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - Contact Info: + Contact Info: address@hidden address@hidden, address@hidden, address@hidden */ @@ -46,7 +46,7 @@ int SwapOff (int move) ****************************************************************************/ { int f, t, sq, piece, lastval; - int side, xside; + int side, xside; int swaplist[MAXPLYDEPTH], n; BitBoard b, c, *d, *e, r; @@ -63,7 +63,7 @@ int SwapOff (int move) AddXrayPiece (t, f, side, &b, &c); d = board.b[side]; - e = board.b[xside]; + e = board.b[xside]; if (move & PROMOTION) { swaplist[0] = Value[PROMOTEPIECE (move)] - ValueP; @@ -81,7 +81,7 @@ int SwapOff (int move) break; for (piece = pawn; piece <= king; piece++) { - r = c & e[piece]; + r = c & e[piece]; if (r) { sq = leadz (r); @@ -99,7 +99,7 @@ int SwapOff (int move) break; for (piece = pawn; piece <= king; piece++) { - r = b & d[piece]; + r = b & d[piece]; if (r) { sq = leadz (r); @@ -116,7 +116,7 @@ int SwapOff (int move) /**************************************************************************** * - * At this stage, we have the swap scores in a list. We just need to + * At this stage, we have the swap scores in a list. We just need to * mini-max the scores from the bottom up to the top of the list. * ****************************************************************************/ @@ -126,12 +126,12 @@ int SwapOff (int move) if (n & 1) { if (swaplist[n] <= swaplist[n-1]) - swaplist[n-1] = swaplist[n]; + swaplist[n-1] = swaplist[n]; } else { if (swaplist[n] >= swaplist[n-1]) - swaplist[n-1] = swaplist[n]; + swaplist[n-1] = swaplist[n]; } --n; } @@ -157,7 +157,7 @@ void AddXrayPiece (int t, int sq, int side, BitBoard *b, BitBoard *c) return; nsq = (t < sq ? leadz (a) : trailz (a)); piece = cboard[nsq]; - if ((piece == queen) || (piece == rook && dir > 3) || + if ((piece == queen) || (piece == rook && dir > 3) || (piece == bishop && dir < 4)) { if (BitPosArray[nsq] & board.friends[side]) diff --git a/src/frontend/util.cc b/src/frontend/util.cc index f5d2781..5d3efe2 100644 --- a/src/frontend/util.cc +++ b/src/frontend/util.cc @@ -4,7 +4,7 @@ Copyright (C) 2001-2011 Free Software Foundation, Inc. - GNU Chess is based on the two research programs + GNU Chess is based on the two research programs Cobalt by Chua Kong-Sian and Gazebo by Stuart Cracraft. This program is free software: you can redistribute it and/or modify @@ -20,7 +20,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - Contact Info: + Contact Info: address@hidden address@hidden, address@hidden, address@hidden */ @@ -79,13 +79,13 @@ void UpdateFriends (void) w = board.b[white]; b = board.b[black]; - board.friends[white] = + board.friends[white] = w[pawn] | w[knight] | w[bishop] | w[rook] | w[queen] | w[king]; - board.friends[black] = + board.friends[black] = b[pawn] | b[knight] | b[bishop] | b[rook] | b[queen] | b[king]; board.blocker = board.friends[white] | board.friends[black]; } - + void UpdateCBoard (void) /************************************************************************** @@ -111,7 +111,7 @@ void UpdateCBoard (void) } -static const int OrigCboard[64] = +static const int OrigCboard[64] = { rook, knight, bishop, queen, king, bishop, knight, rook, pawn, pawn, pawn, pawn, pawn, pawn, pawn, pawn, empty, empty, empty, empty, empty, empty, empty, empty, @@ -131,14 +131,14 @@ void UpdateMvboard (void) **************************************************************************/ { int sq; - + for (sq = 0; sq < 64; sq++) { if (cboard[sq] == empty || cboard[sq] == OrigCboard[sq]) Mvboard[sq] = 0; else Mvboard[sq] = 1; - } + } } @@ -155,12 +155,12 @@ short ValidateBoard (void) { int side, xside, sq; - if (nbits (board.b[white][king]) != 1) + if (nbits (board.b[white][king]) != 1) return (false); - if (nbits (board.b[black][king]) != 1) + if (nbits (board.b[black][king]) != 1) return (false); - side = board.side; + side = board.side; xside = 1^side; if (SqAtakd (board.king[xside], side)) return (false); diff --git a/src/frontend/version.h b/src/frontend/version.h index 6f3a4e4..67612f6 100644 --- a/src/frontend/version.h +++ b/src/frontend/version.h @@ -4,7 +4,7 @@ Copyright (C) 2001-2011 Free Software Foundation, Inc. - GNU Chess is based on the two research programs + GNU Chess is based on the two research programs Cobalt by Chua Kong-Sian and Gazebo by Stuart Cracraft. This program is free software: you can redistribute it and/or modify @@ -20,9 +20,9 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - Contact Info: + Contact Info: address@hidden address@hidden, address@hidden, address@hidden */ #define PROGRAM "GNU Chess" -#define AUTHOR "Chua Kong Sian / Stuart Cracraft" +#define AUTHOR "Chua Kong Sian / Stuart Cracraft" diff --git a/src/main.cc b/src/main.cc index 56d058a..2adda2a 100644 --- a/src/main.cc +++ b/src/main.cc @@ -2,7 +2,7 @@ Copyright (c) 2001-2014 Free Software Foundation, Inc. - GNU Chess is based on the two research programs + GNU Chess is based on the two research programs Cobalt by Chua Kong-Sian and Gazebo by Stuart Cracraft. This program is free software: you can redistribute it and/or modify @@ -16,9 +16,9 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see . + along with this program. If not, see . - Contact Info: + Contact Info: address@hidden address@hidden, address@hidden, address@hidden */ @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include @@ -89,7 +89,7 @@ short bookfirstlast; short graphicmodeoutput; short pgnloaded = 0; int pgncnt = 0; - + char *progname; FILE *ofp; int myrating, opprating; @@ -110,11 +110,11 @@ char algbr[64][3] = "a5", "b5", "c5", "d5", "e5", "f5", "g5", "h5", "a6", "b6", "c6", "d6", "e6", "f6", "g6", "h6", "a7", "b7", "c7", "d7", "e7", "f7", "g7", "h7", - "a8", "b8", "c8", "d8", "e8", "f8", "g8", "h8" + "a8", "b8", "c8", "d8", "e8", "f8", "g8", "h8" }; char algbrfile[9] = "abcdefgh"; char algbrrank[9] = "12345678"; - + char notation[8] = { " PNBRQK" }; char lnotation[8] = { " pnbrqk" }; @@ -153,11 +153,11 @@ short Shift90[64] = int r45[64] = { E4, F3, H2, C2, G1, D1, B1, A1, E5, F4, G3, A3, D2, H1, E1, C1, - D6, F5, G4, H3, B3, E2, A2, F1, + D6, F5, G4, H3, B3, E2, A2, F1, B7, E6, G5, H4, A4, C3, F2, B2, - G7, C7, F6, H5, A5, B4, D3, G2, - C8, H7, D7, G6, A6, B5, C4, E3, - F8, D8, A8, E7, H6, B6, C5, D4, + G7, C7, F6, H5, A5, B4, D3, G2, + C8, H7, D7, G6, A6, B5, C4, E3, + F8, D8, A8, E7, H6, B6, C5, D4, H8, G8, E8, B8, F7, A7, C6, D5 }; short Shift45[64] = @@ -172,12 +172,12 @@ short Shift45[64] = int Mask45[64] = { 0xFF, 0x7F, 0x3F, 0x1F, 0x0F, 0x07, 0x03, 0x01, - 0x7F, 0xFF, 0x7F, 0x3F, 0x1F, 0x0F, 0x07, 0x03, - 0x3F, 0x7F, 0xFF, 0x7F, 0x3F, 0x1F, 0x0F, 0x07, - 0x1F, 0x3F, 0x7F, 0xFF, 0x7F, 0x3F, 0x1F, 0x0F, - 0x0F, 0x1F, 0x3F, 0x7F, 0xFF, 0x7F, 0x3F, 0x1F, - 0x07, 0x0F, 0x1F, 0x3F, 0x7F, 0xFF, 0x7F, 0x3F, - 0x03, 0x07, 0x0F, 0x1F, 0x3F, 0x7F, 0xFF, 0x7F, + 0x7F, 0xFF, 0x7F, 0x3F, 0x1F, 0x0F, 0x07, 0x03, + 0x3F, 0x7F, 0xFF, 0x7F, 0x3F, 0x1F, 0x0F, 0x07, + 0x1F, 0x3F, 0x7F, 0xFF, 0x7F, 0x3F, 0x1F, 0x0F, + 0x0F, 0x1F, 0x3F, 0x7F, 0xFF, 0x7F, 0x3F, 0x1F, + 0x07, 0x0F, 0x1F, 0x3F, 0x7F, 0xFF, 0x7F, 0x3F, + 0x03, 0x07, 0x0F, 0x1F, 0x3F, 0x7F, 0xFF, 0x7F, 0x01, 0x03, 0x07, 0x0F, 0x1F, 0x3F, 0x7F, 0xFF }; int r315[64] = @@ -230,7 +230,7 @@ int main (int argc, char *argv[]) * Note: we have to support "xboard" and "post" as bare strings * for backward compatibility. */ - + int c; int opt_help = 0, opt_version = 0, opt_post = 0, opt_xboard = 0, opt_memory = 0, opt_easy = 0, opt_manual = 0, opt_quiet = 0, opt_uci = 0, opt_graphic = 0; @@ -239,7 +239,7 @@ int main (int argc, char *argv[]) /*disable graphic output by default */ graphicmodeoutput = 0; - + progname = argv[0]; /* Save in global for cmd_usage */ @@ -258,22 +258,22 @@ int main (int argc, char *argv[]) {"manual", 0, 0, 'm'}, {"uci", 0, 0, 'u'}, {"addbook", 1, 0, 'a'}, - {"graphic", 0, 0, 'g'}, + {"graphic", 0, 0, 'g'}, {0, 0, 0, 0} }; - - /* getopt_long stores the option index here. */ + + /* getopt_long stores the option index here. */ int option_index = 0; - + c = getopt_long (argc, argv, "qehmpvxgM:ua:", long_options, &option_index); - + /* Detect the end of the options. */ if (c == -1) break; - /* + /* * Options with a straight flag, could use getoopt_long * flag setting but this is more "obvious" and easier to * modify. @@ -303,8 +303,8 @@ int main (int argc, char *argv[]) break; case 'm': opt_manual = 1; - break; - case 'M': + break; + case 'M': if ( optarg == NULL ){ /* we have error such as two -M */ opt_help = 1; break; @@ -322,7 +322,7 @@ int main (int argc, char *argv[]) case 'u': opt_uci = 1; break; - case 'a': + case 'a': if ( optarg == NULL ){ /* we have error such as two -a */ opt_help = 1; break; @@ -342,7 +342,7 @@ int main (int argc, char *argv[]) /* Initialize random number generator */ srand((unsigned int) time(NULL)); - + /* initialize control flags */ flags = ULL(0); @@ -364,16 +364,16 @@ int main (int argc, char *argv[]) if (opt_uci == 1) SET (flags, UCI); if (opt_post == 1) { - SET (flags, POST); + SET (flags, POST); } if (opt_manual ==1) SET (flags, MANUAL); cmd_version(); - + /* If the version option was specified we can exit here */ if (opt_version == 1) return(0); - + /* Startup output */ if ( !( flags & XBOARD ) && ( !opt_quiet ) && ( !opt_uci) ) { printf( "Copyright (C) 2014 Free Software Foundation, Inc.\n" ); @@ -425,7 +425,7 @@ int main (int argc, char *argv[]) } if (opt_post == 1) { - SET (flags, POST); + SET (flags, POST); char data[9]; strcpy( data, "post" ); SendToEngine( data ); @@ -444,18 +444,18 @@ int main (int argc, char *argv[]) SET (flags, XBOARD); } else if (strcmp(argv[i],"post") == 0) { SET (flags, POST); - } + } } if ( opt_graphic == 1) { graphicmodeoutput = 1; } - + } bookfirstlast = 3; - + /* While not quit * If user input buffer not empty * Read next line from user input buffer @@ -500,7 +500,7 @@ int main (int argc, char *argv[]) /* Avoid using 100% CPU */ usleep(100); } - + dbg_close(); return (0); } -- 2.2.0