summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFranklin Wei <me@fwei.tk>2017-05-28 19:16:43 -0400
committerFranklin Wei <me@fwei.tk>2017-05-28 19:16:43 -0400
commitf86b29a6f4dfbcdcb16110f209077d5b13f3fcfb (patch)
tree84195e27c405718c7c268e62abf809613e16fd63
parent988afccc360e6e1e22161ccc63518fc253c6b1f7 (diff)
downloadxenonchess-f86b29a6f4dfbcdcb16110f209077d5b13f3fcfb.zip
xenonchess-f86b29a6f4dfbcdcb16110f209077d5b13f3fcfb.tar.gz
xenonchess-f86b29a6f4dfbcdcb16110f209077d5b13f3fcfb.tar.bz2
xenonchess-f86b29a6f4dfbcdcb16110f209077d5b13f3fcfb.tar.xz
bugfixes and improvements
-rw-r--r--Makefile7
-rw-r--r--chess.c14
2 files changed, 16 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index 5865d3c..63407f1 100644
--- a/Makefile
+++ b/Makefile
@@ -10,6 +10,8 @@ PREFIX = /usr
BINDIR = $(PREFIX)/bin
LIBDIR = $(PREFIX)/lib
+TSCP = /usr/local/bin/tscp
+
INCLUDES =
LIBS =
@@ -28,7 +30,10 @@ $(PROGRAM_NAME)-old: Makefile $(HEADERS) $(SRC)
$(CC) $(SRC) -o $@ $(CFLAGS) $(LIBS)
test: all
- $(CUTECHESS) -engine name=xenon-new proto=uci dir=`pwd` cmd=./xenonchess -engine proto=uci dir=`pwd` cmd=./xenonchess-old name=xenon-old -each tc=2+.02 -rounds 500
+ $(CUTECHESS) -engine name=xenon-new proto=uci dir=`pwd` cmd=./xenonchess -engine proto=uci dir=`pwd` cmd=./xenonchess-old name=xenon-old -each tc=inf -rounds 100
+
+test-tscp: $(PROGRAM_NAME)
+ $(CUTECHESS) -engine name=xenon-new proto=uci dir=`pwd` cmd=./xenonchess -engine proto=xboard dir=/ cmd=$(TSCP) name=tscp -each tc=2+.02 -rounds 100
%.o: %.c Makefile $(HEADERS)
@echo "CC $<"
diff --git a/chess.c b/chess.c
index a0e2e41..7e00a94 100644
--- a/chess.c
+++ b/chess.c
@@ -5,6 +5,7 @@
//#define AUTOMATCH
#define UCI
+//#define CHECK_EXTENSIONS
#if defined(AUTOMATCH) && defined(UCI)
#error stupid
@@ -28,9 +29,7 @@ int count_material(const struct chess_ctx *ctx, int color)
if(ctx->board[y][x].color == color)
{
total += values[ctx->board[y][x].type];
-#ifdef TEST_FEATURE
total += location_bonuses[ctx->board[y][x].type - 1][color == WHITE ? y : 7 - y][x];
-#endif
#if 0
/* pawn near promotion */
@@ -110,8 +109,10 @@ int eval_position(const struct chess_ctx *ctx, int color)
// score -= count_material(ctx, inv_player(color)) * 2;
score += count_material(ctx, color);
score -= count_material(ctx, inv_player(color));
+#ifdef TEST_FEATURE
score += count_space(ctx, color);
score -= count_space(ctx, inv_player(color));
+#endif
#if 0
if(can_castle(ctx, color, QUEENSIDE) || can_castle(ctx, color, KINGSIDE))
@@ -1165,7 +1166,7 @@ struct chess_ctx ctx_from_fen(const char *fen, int *len)
ctx->rook_moved[idx][0] = false;
break;
case '-':
- continue;
+ break;
default:
printf("bad castling info\n");
goto invalid;
@@ -1216,7 +1217,7 @@ invalid:
void parse_moves(struct chess_ctx *ctx, const char *line, int len)
{
- while(len > 0)
+ while(len > 3)
{
const char *before = line;
struct move_t move = move_from_str(ctx, &line, ctx->to_move);
@@ -1300,6 +1301,11 @@ struct chess_ctx get_uci_ctx(void)
fflush(stdout);
}
}
+ else if(!strncasecmp(line, "eval", 4))
+ {
+ printf("info value WHITE: %d, BLACK: %d\n", eval_position(&ctx, WHITE), eval_position(&ctx, BLACK));
+ fflush(stdout);
+ }
free(ptr);
}
}