ChineseCheckers
This project is a solver for two players' Chinese Checkers game using the Alpha Beta pruning algorithm. The program is written in C++ and uses a number of heuristics to improve the performance of the algorithm. Overall, the Chinese Checkers solver program has been built with performance in mind, and is designed to deliver fast and efficient game play. Whether you are playing against a bot or using the program as a library in your own project, you can be confident that the program will deliver high-performance results.
|
This class is used in order to generate the openings. More...
#include <openings_generator.hpp>
Public Member Functions | |
void | generateOpeningsWhite (int depth, std::ofstream *outFile) |
void | generateOpeningsBlack (int depth, std::ofstream *outFile) |
![]() | |
AlphaBeta () | |
AlphaBeta (const std::vector< double > &player_to_win_value_, const std::vector< double > &player_to_lose_value_) | |
ListOfPositionType | getMove (const int &depth, const double &alpha, const double &beta) |
uint_fast64_t | getMove64 (const int &depth) |
void | availableMoves (std::set< uint_fast64_t, decltype(comp_move_)> &result) |
void | tensorflowSortMoves (std::set< uint_fast64_t, decltype(comp_move_)> &possible_moves) |
const double | AlphaBetaEval (const int &depth, double alpha, double beta, const bool &maximizingPlayer, const bool &keepMove, uint_fast64_t hash) |
bool | isHuman () |
void | loadOpenings () |
Player | getMaximizingPlayer () const |
std::vector< double > | getPlayerToLoseValue () |
std::vector< double > | getPlayerToWinValue () |
void | setPlayerToLoseValue (const std::vector< double > &player_to_lose_value_) |
void | setPlayerToWinValue (const std::vector< double > &player_to_win_value_) |
![]() | |
ChineseCheckers () | |
void | newGame () |
bool | move (const Player &player, const ListOfPositionType &list_moves) |
Result | stateOfGame () |
void | moveWithoutVerification (const uint_fast64_t &move) |
Player | getWhoIsToPlay () const |
uint_fast64_t | getBitBoardWhite () const |
uint_fast64_t | getBitBoardBlack () const |
void | printGrid () const |
void | printWhoIsToPlay () const |
Additional Inherited Members | |
![]() | |
std::function< bool(const uint_fast64_t &, const uint_fast64_t &)> | comp_move_ |
std::function< bool(const uint_fast64_t &, const uint_fast64_t &)> | comp_move_black_ |
std::function< bool(const uint_fast64_t &, const uint_fast64_t &)> | comp_move_white_ |
![]() | |
double | heuristicValue () |
void | updateHeuristicValue (const uint_fast64_t &move) |
void | updateHeuristicValueBack (const uint_fast64_t &move) |
std::vector< uint8_t > | bitBoardsAsVector (const bitBoards_t &bb) |
ListOfPositionType | retrieveMoves (const uint_fast64_t &move) |
![]() | |
MoveType | elementaryMove (const PositionType &original_position, const PositionType &arrival_position) const |
bool | isPositionIllegal () const |
int | cantorPairingFunction (const int &x, const int &y) const |
boost::unordered_map< uint32_t, bool > | loadIllegalPositions () const |
void | generateZobristKeys () |
void | computeAndSetZobristHash () |
![]() | |
std::vector< double > | player_to_win_value_ |
std::vector< double > | player_to_lose_value_ |
Player | maximizing_player_ |
uint_fast64_t | best_move_ |
boost::unordered_map< uint_fast64_t, std::pair< double, int > > | transposition_table_ |
boost::unordered_map< uint_fast64_t, std::pair< double, int > >::iterator | it_transposition_table_ |
std::array< boost::unordered_map< bitBoards_t, uint_fast64_t, bitBoardsHasher, bitBoardsEqual >, 2 > | opening_ |
cppflow::model * | model = new cppflow::model("model") |
std::unordered_map< uint_fast64_t, double > | result_tensorFlow_ |
double | heuristic_value_ |
int | fullDepth_ |
std::array< bool, 2 > | won_ = {false, false} |
![]() | |
const uint_fast64_t | un_64_ = static_cast<uint_fast64_t>(1) |
Player | who_is_to_play_ = 0 |
bitBoards_t | bit_boards_ |
uint_fast64_t | zobrist_hash_ |
std::array< boost::unordered_map< uint_fast64_t, uint_fast64_t >, 2 > | zobrist_keys_ |
std::array< boost::unordered_map< uint_fast64_t, uint_fast64_t >, 2 > | zobrist_keys_moves_ |
boost::unordered_map< uint64_t, int > | number_of_times_seen_ |
std::vector< uint64_t > | positions_seen_ |
const uint_fast64_t | winning_positions_white_ = 0xF0E0C08000000000 |
const uint_fast64_t | winning_positions_black_ = 0x000000000103070F |
const boost::unordered_map< uint32_t, bool > | illegal_positions_ |
const std::array< std::array< uint32_t, 8 >, 8 > | cantor_pairing_ |
const std::vector< std::vector< int > > | valid_lines |
const std::vector< std::vector< int > > | valid_lines_illegal |
const std::array< std::pair< int, int >, 64 > | uint64_to_pair_ |
const std::array< std::array< uint_fast64_t, 8 >, 8 > | int_to_uint64_ |
const std::array< std::vector< uint_fast64_t >, 64 > | direct_neighbours_ |
const std::array< std::vector< std::vector< std::pair< std::pair< uint_fast64_t, uint_fast64_t >, uint_fast64_t > > >, 64 > | k_neighbours_ |
This class is used in order to generate the openings.
void OpeningsGenerator::generateOpeningsBlack | ( | int | depth, |
std::ofstream * | outFile | ||
) |
Generates the openings up to a given depth.
depth | Defines the length of the openings we will compute. |
outFile | Defines the file on which the openings must be written. |
void OpeningsGenerator::generateOpeningsWhite | ( | int | depth, |
std::ofstream * | outFile | ||
) |
Generates the openings up to a given depth.
depth | Defines the length of the openings we will compute. |
outFile | Defines the file on which the openings must be written. |