/*1Stockfish, a UCI chess playing engine derived from Glaurung 2.12Copyright (C) 2004-2025 The Stockfish developers (see AUTHORS file)34Stockfish is free software: you can redistribute it and/or modify5it under the terms of the GNU General Public License as published by6the Free Software Foundation, either version 3 of the License, or7(at your option) any later version.89Stockfish is distributed in the hope that it will be useful,10but WITHOUT ANY WARRANTY; without even the implied warranty of11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12GNU General Public License for more details.1314You should have received a copy of the GNU General Public License15along with this program. If not, see <http://www.gnu.org/licenses/>.16*/1718#ifndef SCORE_H_INCLUDED19#define SCORE_H_INCLUDED2021#include <variant>22#include <utility>2324#include "types.h"2526namespace Stockfish {2728class Position;2930class Score {31public:32struct Mate {33int plies;34};3536struct Tablebase {37int plies;38bool win;39};4041struct InternalUnits {42int value;43};4445Score() = default;46Score(Value v, const Position& pos);4748template<typename T>49bool is() const {50return std::holds_alternative<T>(score);51}5253template<typename T>54T get() const {55return std::get<T>(score);56}5758template<typename F>59decltype(auto) visit(F&& f) const {60return std::visit(std::forward<F>(f), score);61}6263private:64std::variant<Mate, Tablebase, InternalUnits> score;65};6667}6869#endif // #ifndef SCORE_H_INCLUDED707172