diff options
| author | Franklin Wei <me@fwei.tk> | 2017-05-28 19:16:43 -0400 |
|---|---|---|
| committer | Franklin Wei <me@fwei.tk> | 2017-05-28 19:16:43 -0400 |
| commit | f86b29a6f4dfbcdcb16110f209077d5b13f3fcfb (patch) | |
| tree | 84195e27c405718c7c268e62abf809613e16fd63 /chess.c | |
| parent | 988afccc360e6e1e22161ccc63518fc253c6b1f7 (diff) | |
| download | xenonchess-f86b29a6f4dfbcdcb16110f209077d5b13f3fcfb.zip xenonchess-f86b29a6f4dfbcdcb16110f209077d5b13f3fcfb.tar.gz xenonchess-f86b29a6f4dfbcdcb16110f209077d5b13f3fcfb.tar.bz2 xenonchess-f86b29a6f4dfbcdcb16110f209077d5b13f3fcfb.tar.xz | |
bugfixes and improvements
Diffstat (limited to 'chess.c')
| -rw-r--r-- | chess.c | 14 |
1 files changed, 10 insertions, 4 deletions
@@ -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); } } |