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.
Loading...
Searching...
No Matches
SolversIndividuals Class Reference

This class is designed to represent individuals in a solver population and contains various methods for manipulating and printing their characteristics. More...

#include <tournament.hpp>

Public Member Functions

 SolversIndividuals ()
 Default constructor.
 
 SolversIndividuals (std::vector< double > &win_, std::vector< double > &lose_)
 Constructor used to set win and lose.
 
SolversIndividualsoperator= (const SolversIndividuals &other)
 Operator used to compare two SolversIndividuals.
 
std::vector< double > get_win ()
 Returns win.
 
std::vector< double > get_lose ()
 Returns lose.
 
double get_score ()
 Returns score.
 
void init_at_random ()
 Inits win and lose at random.
 
void set_win (const std::vector< double > &win_)
 Sets win with the parameter.
 
void set_lose (const std::vector< double > &lose_)
 Sets lose with the parameter.
 
void set_score (const double &score_)
 Sets score with the parameter.
 
void mutate ()
 Mutates a solver.
 
void print_info ()
 Print information about the SolversIndividuals.
 
void print_info_as_matrix ()
 Prints information on win and lose.
 
void print_info_as_matrix_to_file (std::ofstream &file)
 Prints information on win and lose to a file given as a parameter.
 
void crossOver (const SolversIndividuals &Parent1, const SolversIndividuals &Parent2)
 

Private Attributes

std::vector< double > win
 The matrix used to compute the heuristic value for the player we are playing.
 
std::vector< double > lose
 The matrix used to compute the heuristic value for the adversary of the player we are playing.
 
double score
 The score the individual got at its last game.
 

Friends

bool operator< (SolversIndividuals const &s1, SolversIndividuals const &s2)
 Operator used to compare two SolversIndividuals.
 

Detailed Description

This class is designed to represent individuals in a solver population and contains various methods for manipulating and printing their characteristics.

Constructor & Destructor Documentation

◆ SolversIndividuals() [1/2]

SolversIndividuals::SolversIndividuals ( )

Default constructor.

◆ SolversIndividuals() [2/2]

SolversIndividuals::SolversIndividuals ( std::vector< double > &  win_,
std::vector< double > &  lose_ 
)

Constructor used to set win and lose.

Member Function Documentation

◆ crossOver()

void SolversIndividuals::crossOver ( const SolversIndividuals Parent1,
const SolversIndividuals Parent2 
)

◆ get_lose()

std::vector< double > SolversIndividuals::get_lose ( )

Returns lose.

Returns
lose
See also
win
lose
set_win
set_lose
get_win

◆ get_score()

double SolversIndividuals::get_score ( )

Returns score.

Returns
score

◆ get_win()

std::vector< double > SolversIndividuals::get_win ( )

Returns win.

Returns
win
See also
win
lose
set_win
set_lose
get_lose

◆ init_at_random()

void SolversIndividuals::init_at_random ( )

Inits win and lose at random.

See also
set_win
set_lose
get_win
get_lose

◆ mutate()

void SolversIndividuals::mutate ( )

Mutates a solver.

◆ operator=()

SolversIndividuals & SolversIndividuals::operator= ( const SolversIndividuals other)

Operator used to compare two SolversIndividuals.

See also
operator<

◆ print_info()

void SolversIndividuals::print_info ( )

◆ print_info_as_matrix()

void SolversIndividuals::print_info_as_matrix ( )

Prints information on win and lose.

See also
print_info
print_info_as_matrix_to_file

◆ print_info_as_matrix_to_file()

void SolversIndividuals::print_info_as_matrix_to_file ( std::ofstream &  file)

Prints information on win and lose to a file given as a parameter.

Parameters
fileA pointer to the file we want to print information to.
See also
print_info
print_info_as_matrix

◆ set_lose()

void SolversIndividuals::set_lose ( const std::vector< double > &  lose_)

Sets lose with the parameter.

Parameters
lose_The matrix we want to set.
See also
init_at_random
win
lose
set_win
get_win
get_lose

◆ set_score()

void SolversIndividuals::set_score ( const double &  score_)

Sets score with the parameter.

Parameters
score_The score we want to set.
See also
score
get_score

◆ set_win()

void SolversIndividuals::set_win ( const std::vector< double > &  win_)

Sets win with the parameter.

Parameters
win_The matrix we want to set.
See also
init_at_random
win
lose
set_lose
get_win
get_lose

Friends And Related Function Documentation

◆ operator<

bool operator< ( SolversIndividuals const &  s1,
SolversIndividuals const &  s2 
)
friend

Operator used to compare two SolversIndividuals.

See also
operator=

Member Data Documentation

◆ lose

std::vector<double> SolversIndividuals::lose
private

The matrix used to compute the heuristic value for the adversary of the player we are playing.

See also
win
set_win
set_lose
get_win
get_lose

◆ score

double SolversIndividuals::score
private

The score the individual got at its last game.

See also
set_score

◆ win

std::vector<double> SolversIndividuals::win
private

The matrix used to compute the heuristic value for the player we are playing.

See also
lose
set_win
set_lose
get_win
get_lose

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