"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/main.cc" between
gnuchess-6.2.4.tar.gz and gnuchess-6.2.5.tar.gz

About: GNU Chess is a chess-playing program.

main.cc  (gnuchess-6.2.4):main.cc  (gnuchess-6.2.5)
/* GNU Chess 6 - main.cc - entry point /* GNU Chess 6 - main.cc - entry point
Copyright (c) 2001-2016 Free Software Foundation, Inc. Copyright (c) 2001-2017 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. Cobalt by Chua Kong-Sian and Gazebo by Stuart Cracraft.
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
skipping to change at line 36 skipping to change at line 36
#include "components.h" #include "components.h"
#include <time.h> #include <time.h>
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <getopt.h> #include <getopt.h>
#include <errno.h> #include <errno.h>
#include <unistd.h> #include <unistd.h>
#include <locale.h> #include <locale.h>
#include <signal.h>
#include "frontend/common.h" #include "frontend/common.h"
#include "gettext.h" #include "gettext.h"
#define _(str) gettext (str) #define _(str) gettext (str)
unsigned char lzArray[65536]; unsigned char lzArray[65536];
BitBoard BitPosArray[64]; BitBoard BitPosArray[64];
BitBoard NotBitPosArray[64]; BitBoard NotBitPosArray[64];
BitBoard MoveArray[8][64]; BitBoard MoveArray[8][64];
skipping to change at line 92 skipping to change at line 93
char solution[64]; char solution[64];
float SearchTime; float SearchTime;
int MoveLimit[2]; int MoveLimit[2];
float TimeLimit[2]; float TimeLimit[2];
int TCMove; int TCMove;
int TCinc; int TCinc;
float TCTime; float TCTime;
int phase; int phase;
short bookfirstlast; short bookfirstlast;
short graphicmodeoutput; short graphicmodeoutput;
short coords;
short pgnloaded = 0; short pgnloaded = 0;
int pgncnt = 0; int pgncnt = 0;
char *progname; char *progname;
FILE *ofp; FILE *ofp;
int myrating, opprating; int myrating, opprating;
char name[50]; char name[50];
int computerplays; /* Side computer is playing */ int computerplays; /* Side computer is playing */
int n; /* Last mobility returned by CTL */ int n; /* Last mobility returned by CTL */
int ExchCnt[2]; /* How many exchanges? */ int ExchCnt[2]; /* How many exchanges? */
skipping to change at line 217 skipping to change at line 219
0x03, 0x07, 0x0F, 0x1F, 0x3F, 0x7F, 0xFF, 0x7F, 0x03, 0x07, 0x0F, 0x1F, 0x3F, 0x7F, 0xFF, 0x7F,
0x07, 0x0F, 0x1F, 0x3F, 0x7F, 0xFF, 0x7F, 0x3F, 0x07, 0x0F, 0x1F, 0x3F, 0x7F, 0xFF, 0x7F, 0x3F,
0x0F, 0x1F, 0x3F, 0x7F, 0xFF, 0x7F, 0x3F, 0x1F, 0x0F, 0x1F, 0x3F, 0x7F, 0xFF, 0x7F, 0x3F, 0x1F,
0x1F, 0x3F, 0x7F, 0xFF, 0x7F, 0x3F, 0x1F, 0x0F, 0x1F, 0x3F, 0x7F, 0xFF, 0x7F, 0x3F, 0x1F, 0x0F,
0x3F, 0x7F, 0xFF, 0x7F, 0x3F, 0x1F, 0x0F, 0x07, 0x3F, 0x7F, 0xFF, 0x7F, 0x3F, 0x1F, 0x0F, 0x07,
0x7F, 0xFF, 0x7F, 0x3F, 0x1F, 0x0F, 0x07, 0x03, 0x7F, 0xFF, 0x7F, 0x3F, 0x1F, 0x0F, 0x07, 0x03,
0xFF, 0x7F, 0x3F, 0x1F, 0x0F, 0x07, 0x03, 0x01 }; 0xFF, 0x7F, 0x3F, 0x1F, 0x0F, 0x07, 0x03, 0x01 };
extern char userinputbuf[]; extern char userinputbuf[];
void EndProg( int sig __attribute__ ((unused)) )
{
system( "stty sane" );
exit(0);
}
int main (int argc, char *argv[]) int main (int argc, char *argv[])
{ {
int i; int i;
/* Set locale via LC_ALL. */ /* Set locale via LC_ALL. */
setlocale (LC_ALL, ""); setlocale (LC_ALL, "");
#if ENABLE_NLS #if ENABLE_NLS
/* Set the text message domain. */ /* Set the text message domain. */
bindtextdomain (PACKAGE, LOCALEDIR); bindtextdomain (PACKAGE, LOCALEDIR);
skipping to change at line 385 skipping to change at line 393
if (opt_version == 1) if (opt_version == 1)
return(0); return(0);
/* Startup output */ /* Startup output */
if ( !( flags & XBOARD ) && ( !opt_quiet ) && ( !opt_uci) ) { if ( !( flags & XBOARD ) && ( !opt_quiet ) && ( !opt_uci) ) {
printf ( _("\ printf ( _("\
Copyright (C) %s Free Software Foundation, Inc.\n\ Copyright (C) %s Free Software Foundation, Inc.\n\
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\n\ License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\n\
This is free software: you are free to change and redistribute it.\n\ This is free software: you are free to change and redistribute it.\n\
There is NO WARRANTY, to the extent permitted by law.\n"), There is NO WARRANTY, to the extent permitted by law.\n"),
"2016" ); "2017" );
} }
/* If a usage statement is required output it here */ /* If a usage statement is required output it here */
if (opt_help == 1){ if (opt_help == 1){
cmd_usage(); cmd_usage();
return (1); /* Maybe an error if due to bad arguments. */ return (1); /* Maybe an error if due to bad arguments. */
} }
dbg_open(NULL); dbg_open(NULL);
if ( opt_memory != 0 ) if ( opt_memory != 0 )
; /* TODO: to be removed - this is handled by the adapter */ ; /* TODO: to be removed - this is handled by the adapter */
/* Catch SIGINT to exit. */
struct sigaction action;
memset( &action, 0, sizeof(struct sigaction) );
action.sa_handler = EndProg;
sigaction( SIGINT, &action, NULL );
Initialize (); Initialize ();
InitFrontend(); InitFrontend();
if ( ! (flags & UCI ) ) { if ( ! (flags & UCI ) ) {
/* Initialize the adapter, which in turn initializes the engine */ /* Initialize the adapter, which in turn initializes the engine */
InitAdapter(); InitAdapter();
} else { } else {
/* Initialize the engine only; no adapter */ /* Initialize the engine only; no adapter */
InitEngine(); InitEngine();
} }
skipping to change at line 487 skipping to change at line 501
*/ */
//usleep(3000); /* So that Polyglot's and Fruit's banner has enough time to be displayed */ //usleep(3000); /* So that Polyglot's and Fruit's banner has enough time to be displayed */
//strcpy( userinputbuf, "protover 2\n" ); //strcpy( userinputbuf, "protover 2\n" );
while (!(flags & QUIT)) { while (!(flags & QUIT)) {
if ( flags & UCI ) { if ( flags & UCI ) {
/* In UCI mode, just forward input/output to/from engine - no adapter */ /* In UCI mode, just forward input/output to/from engine - no adapter */
ForwardUserInputToEngine(); ForwardUserInputToEngine();
ForwardEngineOutputToUser(); ForwardEngineOutputToUser();
} else { /* Classical GNU Chess mode */ } else { /* Classical GNU Chess mode */
/* Prompt the user, if neither in xboard nor uci mode */
ShowPrompt();
/* Check if there is a new command from the user */ /* Check if there is a new command from the user */
NextUserCmd(); NextUserCmd();
/* Show thinking message */ /* Show thinking message */
if ((flags & THINK) && !(flags & MANUAL) && !(flags & ENDED)) { if ((flags & THINK) && !(flags & MANUAL) && !(flags & ENDED)) {
if (!(flags & XBOARD)) printf(_("Thinking...\n")); if (!(flags & XBOARD)) printf(_("Thinking...\n"));
CLEAR (flags, THINK); CLEAR (flags, THINK);
} }
/* Check if there is a new command from the engine */ /* Check if there is a new command from the engine */
NextEngineCmd(); NextEngineCmd();
/* Check if user input ready for reading. If so, store it in a buffer. */ /* Check if user input ready for reading. If so, store it in a buffer. */
skipping to change at line 511 skipping to change at line 523
ReadFromEngine(); ReadFromEngine();
} }
/* Avoid using 100% CPU */ /* Avoid using 100% CPU */
usleep(100); usleep(100);
} }
dbg_close(); dbg_close();
/* Termintate adapter and engine threads and join them */ /* Termintate adapter and engine threads and join them */
TerminateAdapterEngine(); TerminateAdapterEngine();
TerminateInput();
return (0); return (0);
} }
 End of changes. 8 change blocks. 
4 lines changed or deleted 17 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)