remove MOVE_NO_MOVE (use only MOVE_NONE)
This commit is contained in:
@@ -29,50 +29,6 @@
|
||||
#include "move-gen.h"
|
||||
#include "search.h"
|
||||
|
||||
// #include "common-test.h"
|
||||
|
||||
static move_t move_in_movelist(movelist_t *ml, square_t from, square_t to, piece_type_t pt)
|
||||
{
|
||||
const int nmoves = ml->nmoves;
|
||||
const move_t *moves = ml->move;
|
||||
int movenum = 0;
|
||||
move_t move;
|
||||
for (movenum = 0; movenum < nmoves; ++movenum) {
|
||||
move = moves[movenum];
|
||||
printf("compare %s%s to %s%s pt=%d ",
|
||||
sq_to_string(from), sq_to_string(to),
|
||||
sq_to_string(move_from(move)),
|
||||
sq_to_string(move_to(move)),
|
||||
pt
|
||||
);
|
||||
if (move_from(move) == from && move_to(move) == to) {
|
||||
printf("HIT!\n");
|
||||
if (pt != NO_PIECE_TYPE && move_promoted(move) != pt)
|
||||
continue;
|
||||
printf("move_in_movelist(%s%s) found from=%s to=%s\n",
|
||||
sq_to_string(from), sq_to_string(to),
|
||||
sq_to_string(move_from(move)),
|
||||
sq_to_string(move_to(move)));
|
||||
return move;
|
||||
} else
|
||||
puts("");
|
||||
}
|
||||
return MOVE_NONE;
|
||||
}
|
||||
|
||||
static move_t move_from_str(pos_t *pos, const char *move)
|
||||
{
|
||||
movelist_t movelist;
|
||||
square_t from = sq_from_string(move);
|
||||
square_t to = sq_from_string(move + 2);
|
||||
piece_type_t promoted = piece_t_from_char(*(move + 4));
|
||||
printf("from=%o to=%o promoted=%d\n", from, to, promoted);
|
||||
|
||||
pos_set_checkers_pinners_blockers(pos);
|
||||
pos_legal(pos, pos_gen_pseudo(pos, &movelist));
|
||||
return move_in_movelist(&movelist, from, to, promoted);
|
||||
}
|
||||
|
||||
static void pr_entry(hentry_t *entry)
|
||||
{
|
||||
if (!entry)
|
||||
@@ -91,7 +47,7 @@ int main()
|
||||
hentry_t *entry;
|
||||
move_t move;
|
||||
state_t state;
|
||||
//movelist_t movelist;
|
||||
movelist_t movelist;
|
||||
|
||||
const char *moves_array[] = {
|
||||
"e2e4 e7e5 g1f3 b8c6",
|
||||
@@ -113,19 +69,22 @@ int main()
|
||||
depth++;
|
||||
printf("%s ", token);
|
||||
|
||||
//pos_set_checkers_pinners_blockers(pos);
|
||||
//pos_legal(pos, pos_gen_pseudo(pos, &movelist));
|
||||
move = move_from_str(pos, token);
|
||||
move = move_from_str(token);
|
||||
pos_set_checkers_pinners_blockers(pos);
|
||||
pos_legal(pos, pos_gen_pseudo(pos, &movelist));
|
||||
printf("move: %s\n", move_to_str(buf, move, 0));
|
||||
move_do(pos, move, &state);
|
||||
if ((entry = tt_probe_perft(pos->key, depth))) {
|
||||
printf("tt hit: depth=%d val=%lu",
|
||||
HASH_PERFT_DEPTH(entry->data),
|
||||
HASH_PERFT_VAL(entry->data));
|
||||
} else {
|
||||
tt_store_perft(pos->key, i + 1, depth);
|
||||
printf("tt store: depth=%d val=%lu", depth, (u64)i * 123);
|
||||
};
|
||||
move = move_find_in_movelist(move, &movelist);
|
||||
if (move != MOVE_NONE) {
|
||||
move_do(pos, move, &state);
|
||||
if ((entry = tt_probe_perft(pos->key, depth))) {
|
||||
printf("tt hit: depth=%d val=%lu",
|
||||
HASH_PERFT_DEPTH(entry->data),
|
||||
HASH_PERFT_VAL(entry->data));
|
||||
} else {
|
||||
tt_store_perft(pos->key, i + 1, depth);
|
||||
printf("tt store: depth=%d val=%lu", depth, (u64)i * 123);
|
||||
};
|
||||
}
|
||||
|
||||
token = strtok(NULL, " \t");
|
||||
}
|
||||
|
Reference in New Issue
Block a user