mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 08:43:09 +00:00
Some coding style changes, white space
This commit is contained in:
parent
6cd70676b4
commit
61ab908db3
6 changed files with 126 additions and 121 deletions
|
@ -904,6 +904,7 @@ make_v:
|
|||
/// evaluation of the position from the point of view of the side to move.
|
||||
|
||||
Value Eval::evaluate(const Position& pos) {
|
||||
|
||||
if (Eval::useNNUE)
|
||||
return NNUE::evaluate(pos);
|
||||
else
|
||||
|
@ -956,7 +957,6 @@ std::string Eval::trace(const Position& pos) {
|
|||
<< " Winnable | " << Term(WINNABLE)
|
||||
<< " ------------+-------------+-------------+------------\n"
|
||||
<< " Total | " << Term(TOTAL);
|
||||
|
||||
}
|
||||
|
||||
v = pos.side_to_move() == WHITE ? v : -v;
|
||||
|
|
|
@ -789,9 +789,7 @@ void Position::do_move(Move m, StateInfo& newSt, bool givesCheck) {
|
|||
remove_piece(capsq);
|
||||
|
||||
if (type_of(m) == ENPASSANT)
|
||||
{
|
||||
board[capsq] = NO_PIECE;
|
||||
}
|
||||
|
||||
// Update material hash key and prefetch access to materialTable
|
||||
k ^= Zobrist::psq[captured][capsq];
|
||||
|
@ -1009,7 +1007,8 @@ void Position::do_castling(Color us, Square from, Square& to, Square& rfrom, Squ
|
|||
auto& dp = st->dirtyPiece;
|
||||
dp.dirty_num = 2; // 2 pieces moved
|
||||
|
||||
if (Do) {
|
||||
if (Do)
|
||||
{
|
||||
dp0 = piece_id_on(from);
|
||||
dp1 = piece_id_on(rfrom);
|
||||
dp.pieceId[0] = dp0;
|
||||
|
@ -1021,7 +1020,8 @@ void Position::do_castling(Color us, Square from, Square& to, Square& rfrom, Squ
|
|||
evalList.put_piece(dp1, rto, make_piece(us, ROOK));
|
||||
dp.new_piece[1] = evalList.piece_with_id(dp1);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
dp0 = piece_id_on(to);
|
||||
dp1 = piece_id_on(rto);
|
||||
evalList.put_piece(dp0, from, make_piece(us, KING));
|
||||
|
@ -1395,19 +1395,3 @@ bool Position::pos_is_ok() const {
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
StateInfo* Position::state() const {
|
||||
return st;
|
||||
}
|
||||
|
||||
const EvalList* Position::eval_list() const {
|
||||
return &evalList;
|
||||
}
|
||||
|
||||
PieceId Position::piece_id_on(Square sq) const
|
||||
{
|
||||
assert(piece_on(sq) != NO_PIECE);
|
||||
PieceId pid = evalList.piece_id_list[sq];
|
||||
assert(is_ok(pid));
|
||||
return pid;
|
||||
}
|
||||
|
|
|
@ -443,4 +443,25 @@ inline void Position::do_move(Move m, StateInfo& newSt) {
|
|||
do_move(m, newSt, gives_check(m));
|
||||
}
|
||||
|
||||
inline StateInfo* Position::state() const {
|
||||
|
||||
return st;
|
||||
}
|
||||
|
||||
inline const EvalList* Position::eval_list() const {
|
||||
|
||||
return &evalList;
|
||||
}
|
||||
|
||||
inline PieceId Position::piece_id_on(Square sq) const
|
||||
{
|
||||
|
||||
assert(piece_on(sq) != NO_PIECE);
|
||||
|
||||
PieceId pid = evalList.piece_id_list[sq];
|
||||
assert(is_ok(pid));
|
||||
|
||||
return pid;
|
||||
}
|
||||
|
||||
#endif // #ifndef POSITION_H_INCLUDED
|
||||
|
|
15
src/types.h
15
src/types.h
|
@ -213,6 +213,7 @@ enum PieceId {
|
|||
};
|
||||
|
||||
inline PieceId operator++(PieceId& d, int) {
|
||||
|
||||
PieceId x = d;
|
||||
d = PieceId(int(d) + 1);
|
||||
return x;
|
||||
|
@ -272,8 +273,7 @@ enum Rank : int {
|
|||
};
|
||||
|
||||
// unique number for each piece type on each square
|
||||
enum PieceSquare : uint32_t
|
||||
{
|
||||
enum PieceSquare : uint32_t {
|
||||
PS_NONE = 0,
|
||||
PS_W_PAWN = 1,
|
||||
PS_B_PAWN = 1 * SQUARE_NB + 1,
|
||||
|
@ -291,8 +291,7 @@ enum PieceSquare : uint32_t
|
|||
PS_END2 = 12 * SQUARE_NB + 1
|
||||
};
|
||||
|
||||
struct ExtPieceSquare
|
||||
{
|
||||
struct ExtPieceSquare {
|
||||
PieceSquare from[COLOR_NB];
|
||||
};
|
||||
|
||||
|
@ -303,8 +302,8 @@ constexpr bool is_ok(PieceId pid);
|
|||
constexpr Square rotate180(Square sq);
|
||||
|
||||
// Structure holding which tracked piece (PieceId) is where (PieceSquare)
|
||||
class EvalList
|
||||
{
|
||||
class EvalList {
|
||||
|
||||
public:
|
||||
// Max. number of pieces without kings is 30 but must be a multiple of 4 in AVX2
|
||||
static const int MAX_LENGTH = 32;
|
||||
|
@ -349,8 +348,8 @@ private:
|
|||
};
|
||||
|
||||
// For differential evaluation of pieces that changed since last turn
|
||||
struct DirtyPiece
|
||||
{
|
||||
struct DirtyPiece {
|
||||
|
||||
// Number of changed pieces
|
||||
int dirty_num;
|
||||
|
||||
|
|
|
@ -55,6 +55,7 @@ void on_use_nnue(const Option& o) {
|
|||
}
|
||||
|
||||
void on_eval_file(const Option& o) {
|
||||
|
||||
load_eval_finished = false;
|
||||
init_nnue(o);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue