Skip to content

Commit e868d48

Browse files
Merge branch 'official-pikafish:master' into liground
2 parents d0c2c75 + d462775 commit e868d48

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+354
-316
lines changed

src/benchmark.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
Stockfish, a UCI chess playing engine derived from Glaurung 2.1
3-
Copyright (C) 2004-2023 The Stockfish developers (see AUTHORS file)
3+
Copyright (C) 2004-2024 The Stockfish developers (see AUTHORS file)
44
55
Stockfish is free software: you can redistribute it and/or modify
66
it under the terms of the GNU General Public License as published by

src/benchmark.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
Stockfish, a UCI chess playing engine derived from Glaurung 2.1
3-
Copyright (C) 2004-2023 The Stockfish developers (see AUTHORS file)
3+
Copyright (C) 2004-2024 The Stockfish developers (see AUTHORS file)
44
55
Stockfish is free software: you can redistribute it and/or modify
66
it under the terms of the GNU General Public License as published by

src/bitboard.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
Stockfish, a UCI chess playing engine derived from Glaurung 2.1
3-
Copyright (C) 2004-2023 The Stockfish developers (see AUTHORS file)
3+
Copyright (C) 2004-2024 The Stockfish developers (see AUTHORS file)
44
55
Stockfish is free software: you can redistribute it and/or modify
66
it under the terms of the GNU General Public License as published by

src/bitboard.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
Stockfish, a UCI chess playing engine derived from Glaurung 2.1
3-
Copyright (C) 2004-2023 The Stockfish developers (see AUTHORS file)
3+
Copyright (C) 2004-2024 The Stockfish developers (see AUTHORS file)
44
55
Stockfish is free software: you can redistribute it and/or modify
66
it under the terms of the GNU General Public License as published by
@@ -102,7 +102,7 @@ extern Magic BishopMagics[SQUARE_NB];
102102
extern Magic KnightMagics[SQUARE_NB];
103103
extern Magic KnightToMagics[SQUARE_NB];
104104

105-
constexpr Bitboard square_bb(Square s) {
105+
inline Bitboard square_bb(Square s) {
106106
assert(is_ok(s));
107107
return SquareBB[s];
108108
}

src/evaluate.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
Stockfish, a UCI chess playing engine derived from Glaurung 2.1
3-
Copyright (C) 2004-2023 The Stockfish developers (see AUTHORS file)
3+
Copyright (C) 2004-2024 The Stockfish developers (see AUTHORS file)
44
55
Stockfish is free software: you can redistribute it and/or modify
66
it under the terms of the GNU General Public License as published by
@@ -103,7 +103,7 @@ void NNUE::verify() {
103103
// Returns a static, purely materialistic evaluation of the position from
104104
// the point of view of the given color. It can be divided by PawnValue to get
105105
// an approximation of the material advantage on the board in terms of pawns.
106-
Value Eval::simple_eval(const Position& pos, Color c) {
106+
int Eval::simple_eval(const Position& pos, Color c) {
107107
return PawnValue * (pos.count<PAWN>(c) - pos.count<PAWN>(~c))
108108
+ AdvisorValue * (pos.count<ADVISOR>(c) - pos.count<ADVISOR>(~c))
109109
+ BishopValue * (pos.count<BISHOP>(c) - pos.count<BISHOP>(~c))
@@ -116,15 +116,15 @@ Value Eval::evaluate(const Position& pos) {
116116

117117
assert(!pos.checkers());
118118

119-
Value v;
119+
int v;
120120
Color stm = pos.side_to_move();
121121
int shuffling = pos.rule60_count();
122122
int simpleEval = simple_eval(pos, stm);
123123

124124
int nnueComplexity;
125125
Value nnue = NNUE::evaluate(pos, true, &nnueComplexity);
126126

127-
Value optimism = pos.this_thread()->optimism[stm];
127+
int optimism = pos.this_thread()->optimism[stm];
128128

129129
// Blend optimism and eval with nnue complexity and material imbalance
130130
optimism += optimism * (nnueComplexity + std::abs(simpleEval - nnue)) / 708;
@@ -137,7 +137,7 @@ Value Eval::evaluate(const Position& pos) {
137137
v = v * (263 - shuffling) / 192;
138138

139139
// Guarantee evaluation does not hit the mate range
140-
v = std::clamp(v, VALUE_MATED_IN_MAX_PLY + 1, VALUE_MATE_IN_MAX_PLY - 1);
140+
v = std::clamp(int(v), VALUE_MATED_IN_MAX_PLY + 1, VALUE_MATE_IN_MAX_PLY - 1);
141141

142142
return v;
143143
}

src/evaluate.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
Stockfish, a UCI chess playing engine derived from Glaurung 2.1
3-
Copyright (C) 2004-2023 The Stockfish developers (see AUTHORS file)
3+
Copyright (C) 2004-2024 The Stockfish developers (see AUTHORS file)
44
55
Stockfish is free software: you can redistribute it and/or modify
66
it under the terms of the GNU General Public License as published by
@@ -31,7 +31,7 @@ namespace Eval {
3131

3232
std::string trace(Position& pos);
3333

34-
Value simple_eval(const Position& pos, Color c);
34+
int simple_eval(const Position& pos, Color c);
3535
Value evaluate(const Position& pos);
3636

3737
extern std::string currentEvalFileName;

src/main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
Stockfish, a UCI chess playing engine derived from Glaurung 2.1
3-
Copyright (C) 2004-2023 The Stockfish developers (see AUTHORS file)
3+
Copyright (C) 2004-2024 The Stockfish developers (see AUTHORS file)
44
Stockfish is free software: you can redistribute it and/or modify
55
it under the terms of the GNU General Public License as published by
66
the Free Software Foundation, either version 3 of the License, or

src/misc.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
Stockfish, a UCI chess playing engine derived from Glaurung 2.1
3-
Copyright (C) 2004-2023 The Stockfish developers (see AUTHORS file)
3+
Copyright (C) 2004-2024 The Stockfish developers (see AUTHORS file)
44
55
Stockfish is free software: you can redistribute it and/or modify
66
it under the terms of the GNU General Public License as published by

src/misc.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
Stockfish, a UCI chess playing engine derived from Glaurung 2.1
3-
Copyright (C) 2004-2023 The Stockfish developers (see AUTHORS file)
3+
Copyright (C) 2004-2024 The Stockfish developers (see AUTHORS file)
44
55
Stockfish is free software: you can redistribute it and/or modify
66
it under the terms of the GNU General Public License as published by

src/movegen.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
Stockfish, a UCI chess playing engine derived from Glaurung 2.1
3-
Copyright (C) 2004-2023 The Stockfish developers (see AUTHORS file)
3+
Copyright (C) 2004-2024 The Stockfish developers (see AUTHORS file)
44
55
Stockfish is free software: you can redistribute it and/or modify
66
it under the terms of the GNU General Public License as published by
@@ -72,7 +72,7 @@ ExtMove* generate_moves(const Position& pos, ExtMove* moveList, Bitboard target)
7272
: (pos.check_squares(Pt) | HollowCannonDiscover);
7373

7474
while (b)
75-
*moveList++ = make_move(from, pop_lsb(b));
75+
*moveList++ = Move(from, pop_lsb(b));
7676
}
7777

7878
return moveList;
@@ -106,7 +106,7 @@ ExtMove* generate_all(const Position& pos, ExtMove* moveList) {
106106
b &= ~attacks_bb<ROOK>(OpponentKingSquare);
107107

108108
while (b)
109-
*moveList++ = make_move(ksq, pop_lsb(b));
109+
*moveList++ = Move(ksq, pop_lsb(b));
110110
}
111111

112112
return moveList;
@@ -174,7 +174,7 @@ ExtMove* generate<EVASIONS>(const Position& pos, ExtMove* moveList) {
174174
if (pt == ROOK || pt == CANNON)
175175
b &= ~line_bb(checksq, ksq) | pos.pieces(~us);
176176
while (b)
177-
*moveList++ = make_move(ksq, pop_lsb(b));
177+
*moveList++ = Move(ksq, pop_lsb(b));
178178

179179
// Generate move away hurdle piece evasions for cannon
180180
if (pt == CANNON)
@@ -194,7 +194,7 @@ ExtMove* generate<EVASIONS>(const Position& pos, ExtMove* moveList) {
194194
b = attacks_bb(pt, hurdleSq, pos.pieces()) & ~line_bb(checksq, hurdleSq)
195195
& ~pos.pieces(us);
196196
while (b)
197-
*moveList++ = make_move(hurdleSq, pop_lsb(b));
197+
*moveList++ = Move(hurdleSq, pop_lsb(b));
198198
}
199199
}
200200

@@ -217,7 +217,7 @@ ExtMove* generate<LEGAL>(const Position& pos, ExtMove* moveList) {
217217

218218
while (cur != moveList)
219219
if (!pos.legal(*cur))
220-
*cur = (--moveList)->move;
220+
*cur = *(--moveList);
221221
else
222222
++cur;
223223

src/movegen.h

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
Stockfish, a UCI chess playing engine derived from Glaurung 2.1
3-
Copyright (C) 2004-2023 The Stockfish developers (see AUTHORS file)
3+
Copyright (C) 2004-2024 The Stockfish developers (see AUTHORS file)
44
55
Stockfish is free software: you can redistribute it and/or modify
66
it under the terms of the GNU General Public License as published by
@@ -37,12 +37,10 @@ enum GenType {
3737
LEGAL
3838
};
3939

40-
struct ExtMove {
41-
Move move;
42-
int value;
40+
struct ExtMove: public Move {
41+
int value;
4342

44-
operator Move() const { return move; }
45-
void operator=(Move m) { move = m; }
43+
void operator=(Move m) { data = m.raw(); }
4644

4745
// Inhibit unwanted implicit conversions to Move
4846
// with an ambiguity that yields to a compile error.

0 commit comments

Comments
 (0)