Xiangiqgame
AI engine for Xiangqi
Loading...
Searching...
No Matches
moveselection::MinimaxMoveEvaluatorForConcepts< H, G, P > Class Template Reference

Complies with MoveEvaluatorConcept, and selects move::Move using Minimax algorithm; uses SpaceInfoProviderConcept, BoardStateCoordinatorConcept, and PieceValueProviderConcept interfaces. More...

#include <move_evaluator_minimax_for_concepts.hpp>

Inheritance diagram for moveselection::MinimaxMoveEvaluatorForConcepts< H, G, P >:
Inheritance graph
Collaboration diagram for moveselection::MinimaxMoveEvaluatorForConcepts< H, G, P >:
Collaboration graph

Public Types

using KeyType = typename H::KeyType
 

Public Member Functions

 MinimaxMoveEvaluatorForConcepts (PieceColor evaluating_player, DepthType search_depth, std::shared_ptr< G > game_board, std::shared_ptr< P > game_position_points, std::shared_ptr< H > hash_calculator)
 
void NotifyIllegalMove ()
 
Move SelectMove (const MoveCollection &allowed_moves)
 
const std::optional< moveselection::SearchSummariessearch_summaries () const override
 
DepthType search_depth ()
 
size_t KeySizeBits ()
 
const H & hash_calculator () const
 
const uint32_t zkeys_seed ()
 
- Public Member Functions inherited from MoveEvaluatorBase
virtual gameboard::Move SelectMove (const gameboard::MoveCollection &allowed_moves)=0
 
virtual void NotifyIllegalMove ()=0
 
virtual const std::optional< moveselection::SearchSummariessearch_summaries () const
 
virtual ~MoveEvaluatorBase ()=default
 

Private Member Functions

Move SelectValidMove (const MoveCollection &allowed_moves)
 
Points_t GetPlayerTotal (PieceColor color)
 
SearchSummaryRunFirstSearch (const MoveCollection &allowed_moves)
 
SearchSummaryRunSecondSearch (const MoveCollection &allowed_moves)
 
void IncrementNumMoveSelections ()
 
EqualScoreMoves HandleTrTableHit (SearchSummary &search_summary, MinimaxResultType &result_type, TranspositionTableSearchResult &tr_table_search_result, DepthType search_depth)
 
EqualScoreMoves EvaluateEndOfGameLeaf (PieceColor cur_player, MinimaxResultType &result_type)
 
EqualScoreMoves HandleEndOfGame (PieceColor cur_player, SearchSummary &search_summary, MinimaxResultType &result_type, DepthType search_depth)
 
EqualScoreMoves EvaluateNonWinLeaf (PieceColor cur_player, MinimaxResultType &result_type)
 
EqualScoreMoves HandleLeaf (PieceColor cur_player, SearchSummary &search_summary, MinimaxResultType &result_type, DepthType search_depth)
 
bool IsImprovement (Points_t cur_eval, Points_t previous_best_eval, PieceColor cur_player)
 
void UpdateBestMoves (PieceColor cur_player, Move move, MoveCollection &best_moves, Points_t cur_eval, Points_t &previous_best_eval)
 
EqualScoreMoves FinalizeNodeResult (MinimaxResultType &result_type, Points_t best_eval, MoveCollection best_moves, DepthType search_depth, SearchSummary &search_summary)
 
bool IsPrunable (Points_t &alpha, Points_t &beta, MinimaxResultType &result_type, PieceColor cur_player)
 
Points_t RecursivelyVisitNodes (Move move, PieceColor cur_player, const MoveCollection &allowed_moves, DepthType search_depth, Points_t alpha, Points_t beta, SearchSummary &search_summary, bool use_transposition_table)
 
Points_t InitializedBestEval (PieceColor cur_player)
 
void UpdatePruningParam (Points_t &alpha, Points_t &beta, Points_t cur_eval, PieceColor cur_player)
 
EqualScoreMoves HandleInternalNode (PieceColor cur_player, const MoveCollection &allowed_moves, DepthType &search_depth, Points_t &alpha, Points_t &beta, MinimaxResultType result_type, SearchSummary &search_summary, bool use_transposition_table)
 
EqualScoreMoves MinimaxRecursive (const MoveCollection &allowed_moves, DepthType search_depth, Points_t alpha, Points_t beta, PieceColor cur_player, SearchSummary &search_summary, bool use_transposition_table)
 
EqualScoreMoves RunTimedMinimax (const MoveCollection &allowed_moves, SearchSummary &search_summary, bool use_transposition_table=true)
 
void GetMinimaxMoveAndStats (const MoveCollection &allowed_moves, SearchSummary &search_summary, bool use_transposition_table=true)
 

Private Attributes

PieceColor evaluating_player_
 
std::shared_ptr< P > game_position_points_
 
std::shared_ptr< H > hash_calculator_
 
std::shared_ptr< G > game_board_
 
MoveCountType num_move_selections_
 
DepthType search_depth_
 
moveselection::SearchSummaries search_summaries_
 
PreSearchMoveSorterForConcepts< G, P > move_sorter_
 
std::atomic< bool > game_over_
 

Detailed Description

template<BoardStateCoordinatorConcept H, SpaceInfoProviderConcept G, PieceValueProviderConcept P>
class moveselection::MinimaxMoveEvaluatorForConcepts< H, G, P >

Complies with MoveEvaluatorConcept, and selects move::Move using Minimax algorithm; uses SpaceInfoProviderConcept, BoardStateCoordinatorConcept, and PieceValueProviderConcept interfaces.

Definition at line 132 of file move_evaluator_minimax_for_concepts.hpp.

Member Typedef Documentation

◆ KeyType

Constructor & Destructor Documentation

◆ MinimaxMoveEvaluatorForConcepts()

moveselection::MinimaxMoveEvaluatorForConcepts< H, G, P >::MinimaxMoveEvaluatorForConcepts ( PieceColor  evaluating_player,
DepthType  search_depth,
std::shared_ptr< G >  game_board,
std::shared_ptr< P >  game_position_points,
std::shared_ptr< H >  hash_calculator 
)
inlineexplicit

Definition at line 145 of file move_evaluator_minimax_for_concepts.hpp.

Member Function Documentation

◆ EvaluateEndOfGameLeaf()

EqualScoreMoves moveselection::MinimaxMoveEvaluatorForConcepts< H, G, P >::EvaluateEndOfGameLeaf ( PieceColor  cur_player,
MinimaxResultType result_type 
)
inlineprivate

Definition at line 255 of file move_evaluator_minimax_for_concepts.hpp.

◆ EvaluateNonWinLeaf()

◆ FinalizeNodeResult()

EqualScoreMoves moveselection::MinimaxMoveEvaluatorForConcepts< H, G, P >::FinalizeNodeResult ( MinimaxResultType result_type,
Points_t  best_eval,
MoveCollection  best_moves,
DepthType  search_depth,
SearchSummary search_summary 
)
inlineprivate

Definition at line 354 of file move_evaluator_minimax_for_concepts.hpp.

◆ GetMinimaxMoveAndStats()

void moveselection::MinimaxMoveEvaluatorForConcepts< H, G, P >::GetMinimaxMoveAndStats ( const MoveCollection allowed_moves,
SearchSummary search_summary,
bool  use_transposition_table = true 
)
inlineprivate

Definition at line 556 of file move_evaluator_minimax_for_concepts.hpp.

◆ GetPlayerTotal()

◆ HandleEndOfGame()

EqualScoreMoves moveselection::MinimaxMoveEvaluatorForConcepts< H, G, P >::HandleEndOfGame ( PieceColor  cur_player,
SearchSummary search_summary,
MinimaxResultType result_type,
DepthType  search_depth 
)
inlineprivate

Definition at line 275 of file move_evaluator_minimax_for_concepts.hpp.

◆ HandleInternalNode()

EqualScoreMoves moveselection::MinimaxMoveEvaluatorForConcepts< H, G, P >::HandleInternalNode ( PieceColor  cur_player,
const MoveCollection allowed_moves,
DepthType search_depth,
Points_t alpha,
Points_t beta,
MinimaxResultType  result_type,
SearchSummary search_summary,
bool  use_transposition_table 
)
inlineprivate

Definition at line 439 of file move_evaluator_minimax_for_concepts.hpp.

◆ HandleLeaf()

EqualScoreMoves moveselection::MinimaxMoveEvaluatorForConcepts< H, G, P >::HandleLeaf ( PieceColor  cur_player,
SearchSummary search_summary,
MinimaxResultType result_type,
DepthType  search_depth 
)
inlineprivate

Definition at line 312 of file move_evaluator_minimax_for_concepts.hpp.

◆ HandleTrTableHit()

EqualScoreMoves moveselection::MinimaxMoveEvaluatorForConcepts< H, G, P >::HandleTrTableHit ( SearchSummary search_summary,
MinimaxResultType result_type,
TranspositionTableSearchResult tr_table_search_result,
DepthType  search_depth 
)
inlineprivate

Definition at line 244 of file move_evaluator_minimax_for_concepts.hpp.

◆ hash_calculator()

◆ IncrementNumMoveSelections()

void moveselection::MinimaxMoveEvaluatorForConcepts< H, G, P >::IncrementNumMoveSelections ( )
inlineprivate

Definition at line 239 of file move_evaluator_minimax_for_concepts.hpp.

◆ InitializedBestEval()

◆ IsImprovement()

bool moveselection::MinimaxMoveEvaluatorForConcepts< H, G, P >::IsImprovement ( Points_t  cur_eval,
Points_t  previous_best_eval,
PieceColor  cur_player 
)
inlineprivate

Definition at line 326 of file move_evaluator_minimax_for_concepts.hpp.

◆ IsPrunable()

bool moveselection::MinimaxMoveEvaluatorForConcepts< H, G, P >::IsPrunable ( Points_t alpha,
Points_t beta,
MinimaxResultType result_type,
PieceColor  cur_player 
)
inlineprivate

Definition at line 375 of file move_evaluator_minimax_for_concepts.hpp.

◆ KeySizeBits()

◆ MinimaxRecursive()

EqualScoreMoves moveselection::MinimaxMoveEvaluatorForConcepts< H, G, P >::MinimaxRecursive ( const MoveCollection allowed_moves,
DepthType  search_depth,
Points_t  alpha,
Points_t  beta,
PieceColor  cur_player,
SearchSummary search_summary,
bool  use_transposition_table 
)
inlineprivate

Definition at line 483 of file move_evaluator_minimax_for_concepts.hpp.

◆ NotifyIllegalMove()

◆ RecursivelyVisitNodes()

Points_t moveselection::MinimaxMoveEvaluatorForConcepts< H, G, P >::RecursivelyVisitNodes ( Move  move,
PieceColor  cur_player,
const MoveCollection allowed_moves,
DepthType  search_depth,
Points_t  alpha,
Points_t  beta,
SearchSummary search_summary,
bool  use_transposition_table 
)
inlineprivate

Definition at line 392 of file move_evaluator_minimax_for_concepts.hpp.

◆ RunFirstSearch()

◆ RunSecondSearch()

◆ RunTimedMinimax()

EqualScoreMoves moveselection::MinimaxMoveEvaluatorForConcepts< H, G, P >::RunTimedMinimax ( const MoveCollection allowed_moves,
SearchSummary search_summary,
bool  use_transposition_table = true 
)
inlineprivate

Definition at line 534 of file move_evaluator_minimax_for_concepts.hpp.

◆ search_depth()

◆ search_summaries()

const std::optional< moveselection::SearchSummaries > moveselection::MinimaxMoveEvaluatorForConcepts< H, G, P >::search_summaries ( ) const
inlineoverridevirtual

Reimplemented from MoveEvaluatorBase.

Definition at line 177 of file move_evaluator_minimax_for_concepts.hpp.

◆ SelectMove()

◆ SelectValidMove()

Move moveselection::MinimaxMoveEvaluatorForConcepts< H, G, P >::SelectValidMove ( const MoveCollection allowed_moves)
inlineprivate

Definition at line 200 of file move_evaluator_minimax_for_concepts.hpp.

◆ UpdateBestMoves()

void moveselection::MinimaxMoveEvaluatorForConcepts< H, G, P >::UpdateBestMoves ( PieceColor  cur_player,
Move  move,
MoveCollection best_moves,
Points_t  cur_eval,
Points_t previous_best_eval 
)
inlineprivate

Definition at line 338 of file move_evaluator_minimax_for_concepts.hpp.

◆ UpdatePruningParam()

void moveselection::MinimaxMoveEvaluatorForConcepts< H, G, P >::UpdatePruningParam ( Points_t alpha,
Points_t beta,
Points_t  cur_eval,
PieceColor  cur_player 
)
inlineprivate

Definition at line 426 of file move_evaluator_minimax_for_concepts.hpp.

◆ zkeys_seed()

Member Data Documentation

◆ evaluating_player_

◆ game_board_

◆ game_over_

◆ game_position_points_

std::shared_ptr<P> moveselection::MinimaxMoveEvaluatorForConcepts< H, G, P >::game_position_points_
private

Definition at line 135 of file move_evaluator_minimax_for_concepts.hpp.

◆ hash_calculator_

◆ move_sorter_

◆ num_move_selections_

◆ search_depth_

◆ search_summaries_


The documentation for this class was generated from the following file: