aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAiden Woodruff <woodra@rpi.edu>2025-11-29 12:22:04 -0500
committerAiden Woodruff <woodra@rpi.edu>2025-11-29 12:22:04 -0500
commita0c774f052fb378cf94e184aa0456370dad1647f (patch)
treefa0b72259e5eac47672854dd43e62f2733726b1e
parentdbd7c2c70486b7b1b5153451c6a1ba287c9c8618 (diff)
downloadtipping-points-a0c774f052fb378cf94e184aa0456370dad1647f.tar.gz
tipping-points-a0c774f052fb378cf94e184aa0456370dad1647f.tar.bz2
tipping-points-a0c774f052fb378cf94e184aa0456370dad1647f.zip
change adoption calculation
- src/NameGame.cc (run): count last N uncommitted strategies and report that instead of the last N strategies. Signed-off-by: Aiden Woodruff <woodra@rpi.edu>
-rw-r--r--src/NameGame.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/NameGame.cc b/src/NameGame.cc
index bfd681c..7561946 100644
--- a/src/NameGame.cc
+++ b/src/NameGame.cc
@@ -148,10 +148,19 @@ int NameGame::run(int rounds) {
148 avg /= strategy_record.size() - srlen; 148 avg /= strategy_record.size() - srlen;
149 // std::cout << avg << std::endl; 149 // std::cout << avg << std::endl;
150 int plays = 0; 150 int plays = 0;
151#ifdef TP_ALLSTRAT
151 for (int i = strategy_record.size() - gsize; i < strategy_record.size(); ++i) { 152 for (int i = strategy_record.size() - gsize; i < strategy_record.size(); ++i) {
152 if (!strategy_record[i].committed && strategy_record[i].strategy == 1) 153 if (!strategy_record[i].committed && strategy_record[i].strategy == 1)
153 ++plays; 154 ++plays;
154 } 155 }
156#else
157 for (int i = strategy_record.size() - 1, j = 0; i >= 0 && j < gsize; --i) {
158 if (!strategy_record[i].committed) {
159 ++j;
160 if (strategy_record[i].strategy == 1) ++plays;
161 }
162 }
163#endif
155 return plays; 164 return plays;
156} 165}
157 166