예제 #1
0
static void ProcessCommandLineSwitch( char *MySwitch, char *Value )
{
	char buf[200];
	char *p;

	if ( MySwitch == NULL || *MySwitch == 0 ) /* do we actual have a switch at all */
		return;
	
	if ( strlen( MySwitch ) >= sizeof( buf ) )  /* too long for a real switch do not overrun buffer */
		return;
	
	strcpy( buf, MySwitch );
	
		/* Make it lower case */
	for ( p = buf; *p != 0; ++p )
		*p = tolower((unsigned char) *p);
	
	if ( strcmp( "debug", buf ) == 0 )  /* debug */
		TraceOn( TRUE );
	else 
	{
		sprintf( buf, "Unknown command line switch %s", MySwitch );
		ErrorExit( buf );
	}
}
예제 #2
0
VALUE __cdecl CRScriptCore::trace_set(VALUE self, VALUE v)
{
	switch (v)
	{
	case Qtrue:
		if (s_fTrace == false)
		{
			s_fTrace = true;
			TraceOn();
		}
		break;
	case Qfalse:
		if (s_fTrace)
		{
			s_fTrace = false;
			TraceOff();
		}
		break;
	default:
        rb_raise(rb_eTypeError, "not valid value");
		break;
	}
	return s_fTrace;
}
예제 #3
0
파일: main.c 프로젝트: Censor/Ivanhoe
int main ()
{
  Banner ();
  InitSend ();
  fflush (stdout);
  ICI = FALSE;
  PVHashTable = NULL;
  EvalHash = NULL;
  PawnHash = NULL; /* HACK */
  PawnHashSize = (1 << 16); /* HACK */
  EvalHashSize = (1 << 15); /* HACK */
#ifdef CON_ROBBO_BUILD
  TripleHash = NULL;
  TripleHashSize = (1 << 17);
#endif
  memset ( (void*) ROOT_POSIZIONE0, 0, sizeof (typePOS));
  ROOT_POSIZIONE0->DYN_ROOT = malloc (MAXIMUM_PLY * sizeof (typeDYNAMIC));
  ROOT_POSIZIONE0->DYN = ROOT_POSIZIONE0->DYN_ROOT + 1;
  ROOT_POSIZIONE0->stop = FALSE;
  CPUS_SIZE = 1;
#ifdef YUSUF_MULTICORE
  rp_init ();
#endif
  SMP_HAS_AKTIV = FALSE;
  UCI_White_Bishops_Scale = 45;
  UCI_White_Pawn_Scale = 100;
  UCI_White_Knight_Scale = 300;
  UCI_White_Light_Scale = 310;
  UCI_White_Dark_Scale = 310;
  UCI_White_Rook_Scale = 500;
  UCI_White_Queen_Scale = 950;
  UCI_Black_Bishops_Scale = 45;
  UCI_Black_Pawn_Scale = 100;
  UCI_Black_Knight_Scale = 300;
  UCI_Black_Light_Scale = 310;
  UCI_Black_Dark_Scale = 310;
  UCI_Black_Rook_Scale = 500;
  UCI_Black_Queen_Scale = 950;
  UCI_MATERIAL_WEIGHTING = 1024;
  UCI_PAWNS_WEIGHTING = 1024;
  UCI_KING_SAFETY_WEIGHTING = 1024;
  UCI_STATIC_WEIGHTING = 1024;
  UCI_MOBILITY_WEIGHTING = 1024;

  PAWNS_HASH_ONE_EIGHTH = TRUE;
  UCI_PAWNS_HASH = 4;
  CURRENT_HASH_SIZE = 32;
  InitHash (32);
  InitPawnHash (4);
  InitPVHash (2);
  InitEvalHash (256);
#ifdef SLAB_MEMORY
  InitSlab (SLAB_SIZE);
#else
  InitSlab (0);
#endif
  InitCaptureValues (); /* SLAB_MEM */
  InitPawns (); /* SLAB_MEM? */

#ifdef USER_SPLIT
  CUT_SPLIT_DEPTH = 16;
  ALL_SPLIT_DEPTH = 14;
  PV_SPLIT_DEPTH = 14;
  SPLIT_AT_CUT = TRUE;
#endif
  SEND_CURR_MOVE = FALSE;
  USE_ALTERNATIVE_TIME = FALSE;
  TIME_IMITATE = FALSE;
  TIME_LOSE_MORE = FALSE;
  TIME_WIN_MORE = FALSE;
  BUFFER_TIME = 0;
  OUTPUT_DELAY = 0;
  UCI_PONDER = FALSE;
  VERIFY_NULL = TRUE;
  ROBBO_LOAD = ROBBO_TOTAL_LOAD = FALSE; 
  SEARCH_ROBBO_BASES = TRUE;
  MULTI_PV = 1;
  SEND_HASH = FALSE; /* aid GUI */
  DO_HASH_FULL = TRUE;
  ALLOW_INSTANT_MOVE = TRUE;
  ZOG_AKTIV = FALSE;
  strcpy (ROBBO_TRIPLE_DIR, "");
  strcpy (ROBBO_TOTAL_DIR, "");
  SEARCH_IS_DONE = TRUE;
  INFINITE_LOOP = FALSE;
#ifndef MINIMAL
  MULTI_CENTI_PAWN_PV = 65535;
  RANDOM_COUNT = 0;
  RANDOM_BITS = 1;
  ALWAYS_ANALYZE = FALSE;
  TRY_PV_IN_ANALYSIS = TRUE;
  FIXED_AGE_ANALYSIS = FALSE;
#endif

#ifdef TRACE_COMPILE
  TraceOn ();
#endif

#ifdef CON_ROBBO_BUILD
  RobboIniz ();
  InitTripleHash (1); /* ensure */
#endif
  TRY_LARGE_PAGES = FALSE;
  SUPPRESS_INPUT = FALSE;
  INPUT_BUFFER = malloc (65536);
  input_ptr = INPUT_BUFFER;
  STALL_MODE = FALSE;
  SINCE_NEW_GAME = 0;
  EASY_FACTOR = 15;
  EASY_FACTOR_PONDER = 33;
  BATTLE_FACTOR = 100;
  ORDINARY_FACTOR = 75;
  ABSOLUTE_PERCENT = 25;
  DESIRED_MILLIS =  40;
  BOOK_EXIT_MOVES = 0;
  EXTEND_IN_CHECK = FALSE;
  TRIPLE_WEAK_PROBE_DEPTH = -10;
  TRIPLE_DEFINITE_PROBE_DEPTH = 40;
  TRIPLE_DEFINITE_PROBE_HEIGHT = 5;
  LOAD_ON_WEAK_PROBE = TRUE;
  STALL_INPUT = FALSE;
  UCI_OPTION_CHESS_960 = FALSE;
#ifdef LINUX_LARGE_PAGES
  LINUX_handle_signals ();
#endif
#ifdef MODE_ANALYSIS
  ICI_HASH_MIX = FALSE;
#endif
  NewGame (ROOT_POSIZIONE0, TRUE);
  while (1)
    Input (ROOT_POSIZIONE0);
  return 0;
}
예제 #4
0
int main( int argc, char *argv[])
{
char *p;
char *Switch, *Value;
char InputFileName[200];
int i;
XTL_FileStatus XTLFileStat;

/* initialize trace to off */
TraceInit(  );
SetTraceOutput( stdout );  /* defaults to stderr if not set, we want stdout */
TraceOn( FALSE );

DL_CL_ProcessArgs( argc, argv );
p = DL_CL_GetProgName( );

printf( "%s", p );
for( i = 0; Copyright[i] != NULL; ++i )
	puts( Copyright[i] );
	
if ( getcwd(CurrentDirectory, sizeof(CurrentDirectory) - 1) == NULL )
{
	CurrentDirectory[0] = 0;
	puts( "Failed to get current working directory" );
}


if (  DL_CL_GetArgCount() != 1 )
{
	for( i = 0; Instructions[i] != NULL; ++i )
		puts( Instructions[i] );
	
	ErrorExit( "\n" );
}
	
strcpy( InputFileName, DL_CL_GetArg( 0 ) );


for ( i = 0; DL_CL_GetSwitch( i, &Switch, &Value ); i++ )
{
	ProcessCommandLineSwitch( Switch, Value );
}

	/* Process and envirnmant variables */	
	ProcessEnvVars();


/* initialize the XronosIO library */
XronosIOInit();
XTL_SubVars_Init();

	/* init stuff from Conf file */
	puts( "Processing Conf file" );
	printf( "Conf File: %s\n", ConfFileName );
	if ( DL_ReadIniFile(ConfFileName) != 0 )
		ErrorExit( "Failed to read conf file" );

	p = DL_GetIniValue( "XF_MaxQuestions", NULL );
	if ( p != NULL )
	{
		SetMaxQuestions( atoi(p) );
	}
	
	QuestionsOnly = DL_GetIniBOOLValue( "XF_QuestionsOnly", QuestionsOnly );
	
	TagsRequired = DL_GetIniBOOLValue( "XF_TagsRequired", TagsRequired );
	
	SB_Texttt_removal = DL_GetIniBOOLValue( "SageBug_Texttt_removal", SB_Texttt_removal );

	InitUserDefinedSubstitution( );
	
	p = DL_GetIniStringValue( "XF_OutputFileHeader", NULL );
	if ( p != NULL )
	{
	strcpy( FileForOutputHeader, p );
	}
	
	p = DL_GetIniStringValue( "XF_OutputFileFooter", NULL );
	if ( p != NULL )
	{
	strcpy( FileForOutputFooter, p );
	}
	
	p = DL_GetIniStringValue( "XF_InputFileHeader", NULL );
	if ( p != NULL )
	{
	if ( XronosIO_SetHeaderFile( p ) != 0 )
		ErrorExit( "failed to set XF_InputFileHeader value" );
	printf( "Set Input HeaderFile: %s\n", p );
	}
	
	p = DL_GetIniStringValue( "XF_InputFileFooter", NULL );
	if ( p != NULL )
	{
	if ( XronosIO_SetFooterFile( p ) != 0 )
		ErrorExit( "failed to set XF_InputFileFooter value" );
	printf( "Set Input FooterFile: %s\n", p );
	}
	
	DL_DiscardIniFile();
	puts( "Done Processing Conf file" );
	/* end ini stuff */

strcpy( OutputFileName, InputFileName );

/* Load file into memory */
printf( "*** Reading input file: %s\n", InputFileName );
ReadInputFile( InputFileName );

/* kill dups */
puts( "*** Killing Dups" );
KillDups( );

/* deal with braces */
RecycleBuffers( );  /* recycle the previous pass output to the new pass input */
puts( "*** Braces processing" );
Braces( );

/* deal with question limit on file size */
RecycleBuffers( );  /* recycle the previous pass output to the new pass input */
puts( "*** Question Limit processing" );
QuestionLimit( );

if ( SB_Texttt_removal )
{
	/* deal with \text{\texttt{}} sage bug */
	RecycleBuffers( );  /* recycle the previous pass output to the new pass input */
	puts( "*** Texttt Removal processing" );
	TextttRemoval( );
}

/* deal with substitution processing - should be JUST before WriteOutputFile() */
RecycleBuffers( );  /* recycle the previous pass output to the new pass input */
puts( "*** Internal variable substitution processing" );
HandleSubstitution( );

/* write output file */
RecycleBuffers( );  /* recycle the previous pass output to the new pass input */
printf( "*** Writing Output file; %s\n", OutputFileName );
WriteOutputFile( OutputFileName );

puts( "*** Program Complete\n" );
return 0;
}