summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFranklin Wei <me@fwei.tk>2017-05-28 16:30:39 -0400
committerFranklin Wei <me@fwei.tk>2017-05-28 16:30:39 -0400
commit0bbdcc8bd920421b19f4d25d416d8c3f1ae13cda (patch)
tree9e25a551626e48b6e45539ba29b58812bad77167
parent80ac3131ca5f1aa9d56ee0f3ffd723af55184d23 (diff)
downloadxenonchess-0bbdcc8bd920421b19f4d25d416d8c3f1ae13cda.zip
xenonchess-0bbdcc8bd920421b19f4d25d416d8c3f1ae13cda.tar.gz
xenonchess-0bbdcc8bd920421b19f4d25d416d8c3f1ae13cda.tar.bz2
xenonchess-0bbdcc8bd920421b19f4d25d416d8c3f1ae13cda.tar.xz
PST test
-rw-r--r--Makefile6
-rw-r--r--chess.c22
2 files changed, 15 insertions, 13 deletions
diff --git a/Makefile b/Makefile
index aecde2b..5865d3c 100644
--- a/Makefile
+++ b/Makefile
@@ -21,14 +21,14 @@ CFLAGS = -Ofast -g -Wall -Wextra -std=gnu99 $(INCLUDES)
all: Makefile $(PROGRAM_NAME) $(PROGRAM_NAME)-old
-$(PROGRAM_NAME): Makefile $(HEADERS)
+$(PROGRAM_NAME): Makefile $(HEADERS) $(SRC)
$(CC) $(SRC) -o $@ $(CFLAGS) $(LIBS) -DTEST_FEATURE
-$(PROGRAM_NAME)-old: Makefile $(HEADERS)
+$(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=1+.01 -rounds 100
+ $(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
%.o: %.c Makefile $(HEADERS)
@echo "CC $<"
diff --git a/chess.c b/chess.c
index 081a704..f27673f 100644
--- a/chess.c
+++ b/chess.c
@@ -1,6 +1,6 @@
#include "chess.h"
-#define DEPTH 1
+#define DEPTH 2
#define MAX_DEPTH DEPTH + 2
//#define AUTOMATCH
@@ -14,12 +14,12 @@ int count_material(const struct chess_ctx *ctx, int color)
{
int total = 0;
static const int values[] = { 0,
- 1, /* pawn */
- 8, /* rook */
- 3, /* knight */
- 3, /* bishop */
- 20, /* queen */
- 5 /* king */
+ 100, /* pawn */
+ 500, /* rook */
+ 320, /* knight */
+ 330, /* bishop */
+ 900, /* queen */
+ 20000 /* king */
};
for(int y = 0; y < 8; ++y)
{
@@ -27,7 +27,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] * 100;
+ 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
@@ -106,8 +106,10 @@ int eval_position(const struct chess_ctx *ctx, int color)
{
int score = 0;
- score += count_material(ctx, color) * 4;
- score -= count_material(ctx, inv_player(color)) * 2;
+// score += count_material(ctx, color) * 4;
+// score -= count_material(ctx, inv_player(color)) * 2;
+ score += count_material(ctx, color);
+ score -= count_material(ctx, inv_player(color));
score += count_space(ctx, color);
score -= count_space(ctx, inv_player(color));