Cleaned retrospective learning

This commit is contained in:
Matúš Púll 2024-11-03 14:36:46 +01:00
parent de5b6f183a
commit f009a278ea

View file

@ -135,21 +135,13 @@ public:
} }
bool learn_back(Historic_guess hist) { bool learn_back(Historic_guess hist) {
bool something_to_learn = true;
hist = clean(hist);
// TODO Actually learn
return something_to_learn;
}
void learn(vector<int> p_guess, vector<int> p_response) {
bool something_to_learn; bool something_to_learn;
// A bit of cleaning // A bit of cleaning
auto cleaned = clean({p_guess, p_response}); auto cleaned = clean(hist);
vector<int> guess = cleaned.guess; vector<int> guess = cleaned.guess;
vector<int> response = cleaned.response; vector<int> response = cleaned.response;
// None of these colors are there // None of these colors are there
if(response[0] == 0 && response[1] == 0) { if(response[0] == 0 && response[1] == 0) {
empty(guess); empty(guess);
@ -165,15 +157,20 @@ public:
// At least only on the right spot // At least only on the right spot
else if(response[0] == 0) { else if(response[0] == 0) {
if_not_here_then_nowhere(guess); if_not_here_then_nowhere(guess);
// TODO maybe I can guess which one is right
something_to_learn = true; something_to_learn = true;
} }
// TODO nonzero / nonzero // Nonzero / nonzero
else { else {
something_to_learn = true; something_to_learn = true;
} }
return something_to_learn;
}
void learn(vector<int> p_guess, vector<int> p_response) {
// Learn something new
bool something_to_learn = learn_back({p_guess, p_response});
// Learn from previous guesses // Learn from previous guesses
for(int i = 0; i < history.size(); i++) for(int i = 0; i < history.size(); i++)
if(!learn_back(history[i])) { if(!learn_back(history[i])) {