2013-09-26 17:14:40 +02:00

117 lines
3.4 KiB
Plaintext

$NetBSD: patch-ad,v 1.5 2013/04/30 22:20:58 joerg Exp $
--- main.cpp.orig 2000-04-01 07:46:20.000000000 +0000
+++ main.cpp
@@ -3,20 +3,23 @@
/* Main functions controlling program */
-#include <iostream.h>
-#include <iomanip.h>
+#include <iostream>
+#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdio.h>
#include <signal.h>
-#include <fstream.h>
+#include <fstream>
#include "define.h"
+using namespace std;
+
#if UNIX
#include <sys/types.h>
#include <sys/time.h>
+ #include <unistd.h>
#else
#include <windows.h>
#include <time.h>
@@ -42,21 +45,21 @@ int omttc = 0, mttc = 0, inc = 0; float
int display_board = 0;
int analysis_mode = 0;
extern int fail; // flag for fail high/fail low from search
-extern move ponder_move;
+extern my_move ponder_move;
extern int logging;
ofstream logfile;
int MAX_LOGS = 100;
// xboard flag
-int xboard, post, ics, ALLEG = 0, hintflag = 0, count = 1;
+int xboard, post, ics, ALLEG = 0, hintflag = 0, my_count = 1;
int ponder_flag = 1, learn_bk, shout_book;
int no_book = 0; // count of moves without a book move
position reset_pos;
extern int ponder, last_ponder, learn_count, learned;
extern unsigned long TAB_SIZE, PAWN_SIZE;
-// executable directory
+// exchess opening book and search parameters directory
char exec_path[100];
// performance function
@@ -88,21 +91,12 @@ ofstream printer;
int main(int argc, char *argv[])
{
char mstring[10];
- move hint;
+ my_move hint;
xboard = 0; ponder = 0; ics = 0;
learn_count = 0; learned = 0; learn_bk = 1; shout_book = 0;
- strcpy(exec_path, argv[0]);
- // parsing exec path
- int last_slash = 0;
- for(int j = 0; j < 100; j++) {
- if(exec_path[j] == '\0') break;
- if(exec_path[j] == '\\') last_slash = j;
- if(exec_path[j] == '/') last_slash = j;
- }
-
- exec_path[last_slash+1] = '\0';
+ strcpy(exec_path, EXCHESS_DIR);
/* initializing hash tables, check tables, scoring parameters,
and the random number seed and tablebases */
@@ -117,7 +111,7 @@ int main(int argc, char *argv[])
if(li < 10) sprintf(lfile, "run_log.00%i", li);
else if(li < 100) sprintf(lfile, "run_log.0%i", li);
else sprintf(lfile, "run_log.%i", li);
- logfile.open(lfile, ios::noreplace | ios::out);
+ logfile.open(lfile, ios::out);
if(logfile) break;
}
if(!logfile) {
@@ -164,7 +158,7 @@ int main(int argc, char *argv[])
/* main loop */
- while (count > 0)
+ while (my_count > 0)
{
// find a hint move, check book first then look in pv
@@ -745,7 +739,7 @@ void parse_command()
else if(!strcmp(response, "nopost")) { post = 0; }
else if(!strcmp(response, "probe")) { cout << probe_tb(&game_pos,0) << "\n"; }
else if(!strcmp(response, "save") || !strcmp(response, "SR")) { save_game(); }
- else if(!strcmp(response, "quit")) { game_over = 1; count = 0; }
+ else if(!strcmp(response, "quit")) { game_over = 1; my_count = 0; }
else if(!strcmp(response, "performance")) { performance(); }
else if(!strcmp(response, "setboard"))
{ cin >> inboard >> ms >> castle >> ep; mttc = omttc; game_over = 0;
@@ -795,7 +789,7 @@ void performance()
// when the best move was first found and held on to.
float soltime;
-int bmcount, tsuite = 0; move bmoves[10];
+int bmcount, tsuite = 0; my_move bmoves[10];
int best_depth, best_score;
extern int stage;
unsigned long nodes, nodes1, test_time, test_time1;