add GAMESIZE (attention: **WRONG**, as for repeat only !)

This commit is contained in:
2024-06-08 20:12:19 +02:00
parent 5a2cdfca56
commit 660d181e41
4 changed files with 20 additions and 8 deletions

View File

@@ -18,9 +18,10 @@
#define ONE 1ull #define ONE 1ull
#define U64(const_u64) const_u64##ULL #define U64(const_u64) const_u64##ULL
#define BIT(i) ( (u64) (ONE << (i)) ) #define BIT(i) ( (u64) (ONE << (i)) )
#define BOARDSIZE (8*8) #define BOARDSIZE (8*8)
#define GAMESIZE 1024 /* max game size (512 moves) */
/** /**
* sq_rel - get relative square * sq_rel - get relative square

View File

@@ -1,6 +1,6 @@
/* eval.h - static position evaluation. /* eval.h - static position evaluation.
* *
* Copyright (C) 2021 Bruno Raoult ("br") * Copyright (C) 2021-2024 Bruno Raoult ("br")
* Licensed under the GNU General Public License v3.0 or later. * Licensed under the GNU General Public License v3.0 or later.
* Some rights reserved. See COPYING. * Some rights reserved. See COPYING.
* *

View File

@@ -123,7 +123,8 @@ pos_t *pos_clear(pos_t *pos)
pos->pinners = 0; pos->pinners = 0;
pos->blockers = 0; pos->blockers = 0;
//pos->moves.nmoves = 0; pos->repeat.moves = 0;
return pos; return pos;
} }
@@ -131,9 +132,11 @@ pos_t *pos_clear(pos_t *pos)
* pos_cmp() - compare two positions.. * pos_cmp() - compare two positions..
* @pos1, @pos2: The two &position. * @pos1, @pos2: The two &position.
* *
* Used only for move_{do,undo} test/debug.
*
* @return: true if equal, false otherwise. * @return: true if equal, false otherwise.
*/ */
bool pos_cmp(__unused const pos_t *pos1, __unused const pos_t *pos2) bool pos_cmp(const pos_t *pos1, const pos_t *pos2)
{ {
#define _cmpf(a) (pos1->a != pos2->a) #define _cmpf(a) (pos1->a != pos2->a)
bool ret = false; bool ret = false;
@@ -142,8 +145,11 @@ bool pos_cmp(__unused const pos_t *pos1, __unused const pos_t *pos2)
goto end; goto end;
/* move_do/undo position state */ /* move_do/undo position state */
if (_cmpf(en_passant) || _cmpf(castle) || if (_cmpf(key) || _cmpf(en_passant) || _cmpf(castle) ||
_cmpf(clock_50) || _cmpf(plycount)) _cmpf(clock_50) || _cmpf(plycount) || _cmpf(captured))
goto end;
if (_cmpf(checkers) || _cmpf(pinners) || _cmpf(blockers))
goto end; goto end;
for (square_t sq = A1; sq <= H8; ++sq) for (square_t sq = A1; sq <= H8; ++sq)
@@ -151,7 +157,7 @@ bool pos_cmp(__unused const pos_t *pos1, __unused const pos_t *pos2)
goto end; goto end;
for (color_t color = WHITE; color <= BLACK; ++color) { for (color_t color = WHITE; color <= BLACK; ++color) {
for (piece_type_t piece = 0; piece <= KING; ++piece) for (piece_type_t piece = ALL_PIECES; piece <= KING; ++piece)
if (_cmpf(bb[color][piece])) if (_cmpf(bb[color][piece]))
goto end; goto end;
if (_cmpf(king[color])) if (_cmpf(king[color]))
@@ -161,6 +167,11 @@ bool pos_cmp(__unused const pos_t *pos1, __unused const pos_t *pos2)
if (_cmpf(checkers) ||_cmpf(pinners) || _cmpf(blockers)) if (_cmpf(checkers) ||_cmpf(pinners) || _cmpf(blockers))
goto end; goto end;
if (_cmpf(repeat.moves) ||
memcmp(pos1->repeat.key, pos2->repeat.key,
pos1->repeat.moves * sizeof pos1->repeat.key))
goto end;
ret = true; ret = true;
end: end:
return ret; return ret;

View File

@@ -43,6 +43,6 @@
/* restore BUG_ON /* restore BUG_ON
*/ */
# pragma pop_macro("BUG_ON") #pragma pop_macro("BUG_ON")
#endif /* UTIL_H */ #endif /* UTIL_H */