diff options
| author | Aiden Woodruff <woodra@rpi.edu> | 2025-11-19 23:54:43 -0500 |
|---|---|---|
| committer | Aiden Woodruff <woodra@rpi.edu> | 2025-11-19 23:54:43 -0500 |
| commit | 9fca61c7909684905122e58798c87950f861e6b5 (patch) | |
| tree | a1fcbcc413cd1eb14286b36d0716c62da6413f44 /src | |
| parent | fbc1f58bd202ae2fff80e20f874812d5351b5318 (diff) | |
| download | tipping-points-9fca61c7909684905122e58798c87950f861e6b5.tar.gz tipping-points-9fca61c7909684905122e58798c87950f861e6b5.tar.bz2 tipping-points-9fca61c7909684905122e58798c87950f861e6b5.zip | |
update verbose game formatting
- src/NameGame.cc (NameGame::runRound): shorten output.
- make line lengths the same so it's easier to see.
- output hearer info again.
Signed-off-by: Aiden Woodruff <woodra@rpi.edu>
Diffstat (limited to 'src')
| -rw-r--r-- | src/NameGame.cc | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/NameGame.cc b/src/NameGame.cc index e18d419..5b79f87 100644 --- a/src/NameGame.cc +++ b/src/NameGame.cc | |||
| @@ -1,4 +1,5 @@ | |||
| 1 | #include <fstream> | 1 | #include <fstream> |
| 2 | #include <iomanip> | ||
| 2 | #include <iostream> | 3 | #include <iostream> |
| 3 | #include <map> | 4 | #include <map> |
| 4 | #include <stdexcept> | 5 | #include <stdexcept> |
| @@ -96,9 +97,13 @@ void NameGame::runRound(int r) { | |||
| 96 | // Speaker chooses best strategy. | 97 | // Speaker chooses best strategy. |
| 97 | int strategy = best_move(speaker.GetId()); | 98 | int strategy = best_move(speaker.GetId()); |
| 98 | if (verbose_flag) { | 99 | if (verbose_flag) { |
| 99 | std::cout << "speaker (" << speaker.GetId() << " " | 100 | char s_committed = speaker().Val1 ? 'C' : 'U', |
| 100 | << std::boolalpha << speaker().Val1 | 101 | h_committed = hearer().Val1 ? 'C' : 'U'; |
| 101 | << ") chose: " << strategy << std::endl; | 102 | char oldfill = std::cout.fill('0'); |
| 103 | std::cout << "S" << std::setw(2) << speaker.GetId() | ||
| 104 | << '(' << s_committed << ") - H" << std::setw(2) << hearer.GetId() | ||
| 105 | << '(' << h_committed << "): " << strategy << std::endl; | ||
| 106 | std::cout.fill(oldfill); | ||
| 102 | } | 107 | } |
| 103 | 108 | ||
| 104 | // Hearer updates memory. | 109 | // Hearer updates memory. |
