Bot mode only shows history

This commit is contained in:
Matúš Púll 2024-11-08 21:36:34 +01:00
parent 4ee22b14e9
commit 8b5a69ffbc

View file

@ -32,11 +32,9 @@ int main(int argc, char* argv[]) {
cin >> sequence[n];
}
// Terminal clearing
cout << std::endl;
// Human info
if(player == HUMAN) {
cout << std::endl;
cout << "Guesses are " << N << " space-separated numbers from 0 to " << M-1 << std::endl
<< "Responses are in format [correct out of place] / [correct in place]" << std::endl;
cout << std::endl;
@ -49,20 +47,18 @@ int main(int argc, char* argv[]) {
vector<vector<int>> history = {};
for(int guesses = 0; guesses < 10; guesses++) {
vector<int> guess(N), response;
cout << "Guess " << history.size() << " : ";
// Bot playin
if(player == BOT) {
guess = bot.guess();
cout << format_guess(guess);
response = validate(sequence, guess);
cout << format_response(response);
bot.learn(guess, response);
}
// Human playing
else if(player == HUMAN) {
cout << "Guess " << history.size() << " : ";
for(int n = 0; n < N; n++)
cin >> guess[n];
@ -83,7 +79,8 @@ int main(int argc, char* argv[]) {
cout << std::endl;
// Print game history
cout << "History\n";
if(player == HUMAN)
cout << "History\n";
for(auto guess : history)
cout << format_guess_history(sequence, guess) << std::endl;