111 lines
2.4 KiB
Text
111 lines
2.4 KiB
Text
$NetBSD: patch-ac,v 1.1.1.1 2000/10/15 08:38:22 jlam Exp $
|
|
|
|
--- knightcap.c.orig Sun May 17 19:09:21 1998
|
|
+++ knightcap.c
|
|
@@ -6,7 +6,7 @@
|
|
#include "trackball.h"
|
|
#include "knightcap.h"
|
|
|
|
-static int window_size = 500;
|
|
+int window_size = 500;
|
|
|
|
#define SLEEP_TIME 100000 /* microseconds */
|
|
#define REFRESH_TIME 20 /* in seconds */
|
|
@@ -21,6 +21,7 @@
|
|
int seek_answering=0;
|
|
int demo_mode = 0;
|
|
|
|
+static int starts = 0; /* default to no computer play */
|
|
static int opponent;
|
|
static int always_think;
|
|
static int no_display;
|
|
@@ -56,7 +57,7 @@
|
|
char *ics_master = NULL;
|
|
char *coeffs_file = NULL;
|
|
char *bad_eval_file = "bad_eval.dat";
|
|
-char *tb_path = "../EGTB";
|
|
+char *tb_path = TB_DIR;
|
|
|
|
char play_target[100];
|
|
|
|
@@ -82,7 +83,7 @@
|
|
void reset_board(void)
|
|
{
|
|
setup_board(&state->position);
|
|
- state->computer = 0;
|
|
+ state->computer = starts;
|
|
state->moved = 0;
|
|
state->always_think = always_think;
|
|
state->use_mulling = use_mulling;
|
|
@@ -945,7 +946,7 @@
|
|
reset_board();
|
|
init_movements();
|
|
|
|
- signal(SIGCLD, SIG_IGN);
|
|
+ signal(SIGCHLD, SIG_IGN);
|
|
|
|
pid1 = getpid();
|
|
|
|
@@ -1000,6 +1001,11 @@
|
|
"-T <name> target ICS opponent\n" \
|
|
"-G <file> endgame tablebsae directory\n" \
|
|
"-y don't mull\n" \
|
|
+"-1 Computer plays white\n" \
|
|
+"-2 Computer plays black\n" \
|
|
+"-0 Computer plays neither white nor black\n" \
|
|
+"\n" \
|
|
+"call xboard with: xboard -fcp 'KnightCap -n -X -A -2'\n" \
|
|
"\n");
|
|
}
|
|
|
|
@@ -1010,7 +1016,11 @@
|
|
#ifdef SUNOS4
|
|
extern char *optarg;
|
|
#endif
|
|
- char *opt = "c:s:w:nI:t:hXAD:l:aH:M:ezdm:f:g:ByEpT:";
|
|
+ /*
|
|
+ * Add support for specifying what colour the computer plays
|
|
+ * at start.
|
|
+ */
|
|
+ char *opt = "012c:s:w:nI:t:hXAD:l:aH:M:ezdm:f:g:ByEpT:";
|
|
int c;
|
|
int seed = getpid();
|
|
|
|
@@ -1030,6 +1040,7 @@
|
|
if (getcid()) break;
|
|
#endif
|
|
window_size = atoi(optarg);
|
|
+ lprintf(0, "Window size: %d\n", window_size);
|
|
break;
|
|
|
|
case 'c':
|
|
@@ -1151,6 +1162,15 @@
|
|
case 'g':
|
|
tb_path = optarg;
|
|
break;
|
|
+ case '0':
|
|
+ starts = 0;
|
|
+ break;
|
|
+ case '1':
|
|
+ starts = 1;
|
|
+ break;
|
|
+ case '2':
|
|
+ starts = -1;
|
|
+ break;
|
|
}
|
|
}
|
|
|
|
@@ -1178,6 +1198,13 @@
|
|
parse_options(argc, argv);
|
|
|
|
create_threads();
|
|
+
|
|
+ /*
|
|
+ * Initialize colour the computer plays to what's specified,
|
|
+ * or default to playing neither side.
|
|
+ */
|
|
+ state->computer = starts;
|
|
+ state->colour = starts;
|
|
|
|
state->ics_robot = ics_mode;
|
|
state->autoplay = ics_mode;
|