1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-05-02 17:49:35 +00:00

Use constants arguments where possible

No functional changes.
This commit is contained in:
homoSapiensSapiens 2013-08-16 09:57:16 +02:00 committed by Marco Costalba
parent 4f55ed14d3
commit e005270fb6
3 changed files with 18 additions and 18 deletions

View file

@ -238,18 +238,18 @@ namespace {
Score evaluate_pieces_of_color(const Position& pos, EvalInfo& ei, Score& mobility); Score evaluate_pieces_of_color(const Position& pos, EvalInfo& ei, Score& mobility);
template<Color Us, bool Trace> template<Color Us, bool Trace>
Score evaluate_king(const Position& pos, EvalInfo& ei, Value margins[]); Score evaluate_king(const Position& pos, const EvalInfo& ei, Value margins[]);
template<Color Us, bool Trace> template<Color Us, bool Trace>
Score evaluate_threats(const Position& pos, EvalInfo& ei); Score evaluate_threats(const Position& pos, const EvalInfo& ei);
template<Color Us, bool Trace> template<Color Us, bool Trace>
Score evaluate_passed_pawns(const Position& pos, EvalInfo& ei); Score evaluate_passed_pawns(const Position& pos, const EvalInfo& ei);
template<Color Us> template<Color Us>
int evaluate_space(const Position& pos, EvalInfo& ei); int evaluate_space(const Position& pos, const EvalInfo& ei);
Score evaluate_unstoppable_pawns(const Position& pos, EvalInfo& ei); Score evaluate_unstoppable_pawns(const Position& pos, const EvalInfo& ei);
Value interpolate(const Score& v, Phase ph, ScaleFactor sf); Value interpolate(const Score& v, Phase ph, ScaleFactor sf);
Score apply_weight(Score v, Score w); Score apply_weight(Score v, Score w);
@ -603,7 +603,7 @@ Value do_evaluate(const Position& pos, Value& margin) {
// and the type of attacked one. // and the type of attacked one.
template<Color Us, bool Trace> template<Color Us, bool Trace>
Score evaluate_threats(const Position& pos, EvalInfo& ei) { Score evaluate_threats(const Position& pos, const EvalInfo& ei) {
const Color Them = (Us == WHITE ? BLACK : WHITE); const Color Them = (Us == WHITE ? BLACK : WHITE);
@ -674,7 +674,7 @@ Value do_evaluate(const Position& pos, Value& margin) {
// evaluate_king<>() assigns bonuses and penalties to a king of a given color // evaluate_king<>() assigns bonuses and penalties to a king of a given color
template<Color Us, bool Trace> template<Color Us, bool Trace>
Score evaluate_king(const Position& pos, EvalInfo& ei, Value margins[]) { Score evaluate_king(const Position& pos, const EvalInfo& ei, Value margins[]) {
const Color Them = (Us == WHITE ? BLACK : WHITE); const Color Them = (Us == WHITE ? BLACK : WHITE);
@ -787,7 +787,7 @@ Value do_evaluate(const Position& pos, Value& margin) {
// evaluate_passed_pawns<>() evaluates the passed pawns of the given color // evaluate_passed_pawns<>() evaluates the passed pawns of the given color
template<Color Us, bool Trace> template<Color Us, bool Trace>
Score evaluate_passed_pawns(const Position& pos, EvalInfo& ei) { Score evaluate_passed_pawns(const Position& pos, const EvalInfo& ei) {
const Color Them = (Us == WHITE ? BLACK : WHITE); const Color Them = (Us == WHITE ? BLACK : WHITE);
@ -889,7 +889,7 @@ Value do_evaluate(const Position& pos, Value& margin) {
// evaluate_unstoppable_pawns() evaluates the unstoppable passed pawns for both sides, this is quite // evaluate_unstoppable_pawns() evaluates the unstoppable passed pawns for both sides, this is quite
// conservative and returns a winning score only when we are very sure that the pawn is winning. // conservative and returns a winning score only when we are very sure that the pawn is winning.
Score evaluate_unstoppable_pawns(const Position& pos, EvalInfo& ei) { Score evaluate_unstoppable_pawns(const Position& pos, const EvalInfo& ei) {
Bitboard b, b2, blockers, supporters, queeningPath, candidates; Bitboard b, b2, blockers, supporters, queeningPath, candidates;
Square s, blockSq, queeningSquare; Square s, blockSq, queeningSquare;
@ -1054,7 +1054,7 @@ Value do_evaluate(const Position& pos, Value& margin) {
// twice. Finally, the space bonus is scaled by a weight taken from the // twice. Finally, the space bonus is scaled by a weight taken from the
// material hash table. The aim is to improve play on game opening. // material hash table. The aim is to improve play on game opening.
template<Color Us> template<Color Us>
int evaluate_space(const Position& pos, EvalInfo& ei) { int evaluate_space(const Position& pos, const EvalInfo& ei) {
const Color Them = (Us == WHITE ? BLACK : WHITE); const Color Them = (Us == WHITE ? BLACK : WHITE);

View file

@ -164,7 +164,7 @@ bool Thread::cutoff_occurred() const {
// which are busy searching the split point at the top of slaves split point // which are busy searching the split point at the top of slaves split point
// stack (the "helpful master concept" in YBWC terminology). // stack (the "helpful master concept" in YBWC terminology).
bool Thread::is_available_to(Thread* master) const { bool Thread::is_available_to(const Thread* master) const {
if (searching) if (searching)
return false; return false;
@ -238,7 +238,7 @@ void ThreadPool::read_uci_options() {
// slave_available() tries to find an idle thread which is available as a slave // slave_available() tries to find an idle thread which is available as a slave
// for the thread 'master'. // for the thread 'master'.
Thread* ThreadPool::available_slave(Thread* master) const { Thread* ThreadPool::available_slave(const Thread* master) const {
for (const_iterator it = begin(); it != end(); ++it) for (const_iterator it = begin(); it != end(); ++it)
if ((*it)->is_available_to(master)) if ((*it)->is_available_to(master))
@ -258,7 +258,7 @@ Thread* ThreadPool::available_slave(Thread* master) const {
// search() then split() returns. // search() then split() returns.
template <bool Fake> template <bool Fake>
void Thread::split(Position& pos, Stack* ss, Value alpha, Value beta, Value* bestValue, void Thread::split(Position& pos, const Stack* ss, Value alpha, Value beta, Value* bestValue,
Move* bestMove, Depth depth, Move threatMove, int moveCount, Move* bestMove, Depth depth, Move threatMove, int moveCount,
MovePicker* movePicker, int nodeType, bool cutNode) { MovePicker* movePicker, int nodeType, bool cutNode) {
@ -348,8 +348,8 @@ void Thread::split(Position& pos, Stack* ss, Value alpha, Value beta, Value* bes
} }
// Explicit template instantiations // Explicit template instantiations
template void Thread::split<false>(Position&, Stack*, Value, Value, Value*, Move*, Depth, Move, int, MovePicker*, int, bool); template void Thread::split<false>(Position&, const Stack*, Value, Value, Value*, Move*, Depth, Move, int, MovePicker*, int, bool);
template void Thread::split< true>(Position&, Stack*, Value, Value, Value*, Move*, Depth, Move, int, MovePicker*, int, bool); template void Thread::split< true>(Position&, const Stack*, Value, Value, Value*, Move*, Depth, Move, int, MovePicker*, int, bool);
// wait_for_think_finished() waits for main thread to go to sleep then returns // wait_for_think_finished() waits for main thread to go to sleep then returns

View file

@ -114,10 +114,10 @@ struct Thread : public ThreadBase {
Thread(); Thread();
virtual void idle_loop(); virtual void idle_loop();
bool cutoff_occurred() const; bool cutoff_occurred() const;
bool is_available_to(Thread* master) const; bool is_available_to(const Thread* master) const;
template <bool Fake> template <bool Fake>
void split(Position& pos, Search::Stack* ss, Value alpha, Value beta, Value* bestValue, Move* bestMove, void split(Position& pos, const Search::Stack* ss, Value alpha, Value beta, Value* bestValue, Move* bestMove,
Depth depth, Move threatMove, int moveCount, MovePicker* movePicker, int nodeType, bool cutNode); Depth depth, Move threatMove, int moveCount, MovePicker* movePicker, int nodeType, bool cutNode);
SplitPoint splitPoints[MAX_SPLITPOINTS_PER_THREAD]; SplitPoint splitPoints[MAX_SPLITPOINTS_PER_THREAD];
@ -160,7 +160,7 @@ struct ThreadPool : public std::vector<Thread*> {
MainThread* main() { return static_cast<MainThread*>((*this)[0]); } MainThread* main() { return static_cast<MainThread*>((*this)[0]); }
void read_uci_options(); void read_uci_options();
Thread* available_slave(Thread* master) const; Thread* available_slave(const Thread* master) const;
void wait_for_think_finished(); void wait_for_think_finished();
void start_thinking(const Position&, const Search::LimitsType&, void start_thinking(const Position&, const Search::LimitsType&,
const std::vector<Move>&, Search::StateStackPtr&); const std::vector<Move>&, Search::StateStackPtr&);