diff --git a/include/Heuristic.hpp b/include/Heuristic.hpp index fbd21cb..a007d36 100644 --- a/include/Heuristic.hpp +++ b/include/Heuristic.hpp @@ -33,6 +33,7 @@ class Heuristic public: void set(int index, int value) { coeff[index] = value; }; int evaluate(bup &bitboard); + std::string coefficientsToString(); // Needed public for variable depth search int jumpeablePieces() const; diff --git a/src/GeneticSimulation.cpp b/src/GeneticSimulation.cpp index 8452930..3c1e5ce 100644 --- a/src/GeneticSimulation.cpp +++ b/src/GeneticSimulation.cpp @@ -74,6 +74,15 @@ void GeneticSimulation::simulate(){ s << "White Wins(after Tie): " << cntTieBlack << std::endl; s << "Black Wins(after Tie): " << cntTieWhite << std::endl; s << "Ties: \t\t" << cntTies << std::endl; + int n = population.size(); + for (int i = 0; i < n; ++i) { + Specimen temp = population.front(); + s << "+++++++++++++++++++++++++++++++" << std::endl; + s << "START: " << std::endl; + s << temp.getStartHeuristics().coefficientsToString(); + s << "END: " << std::endl; + s << temp.getEndHeuristics().coefficientsToString(); + } } s.close(); diff --git a/src/Heuristic.cpp b/src/Heuristic.cpp index 4bc150b..811df19 100644 --- a/src/Heuristic.cpp +++ b/src/Heuristic.cpp @@ -134,6 +134,21 @@ int Heuristic::moveableKings() const return (isBlacksTurn ? 1 : -1) * count(accumK); } +std::string Heuristic::coefficientsToString() +{ + return "pawn count: " + std::to_string(coeff[0]) + "\n" + + "king count: " + std::to_string(coeff[1]) + "\n" + + "safe pawns: " + std::to_string(coeff[2]) + "\n" + + "safe kings: " + std::to_string(coeff[3]) + "\n" + + "pawn promotion distance: " + std::to_string(coeff[4]) + "\n" + + "defender count: " + std::to_string(coeff[5]) + "\n" + + "attacker count: " + std::to_string(coeff[6]) + "\n" + + "open promotion count: " + std::to_string(coeff[7]) + "\n" + + "moveable pawns: " + std::to_string(coeff[8]) + "\n" + + "moveable kings: " + std::to_string(coeff[9]) + "\n" + + "jumpeable pieces: " + std::to_string(coeff[10]) + "\n"; +} + int Heuristic::jumpeablePieces() const { uint32_t accumP = 0;