aboutsummaryrefslogtreecommitdiffstats
path: root/src/NameGame.h
diff options
context:
space:
mode:
authorAiden Woodruff <woodra@rpi.edu>2025-11-16 23:38:16 -0500
committerAiden Woodruff <woodra@rpi.edu>2025-11-16 23:38:16 -0500
commitf7d2e7c8a70e4d96c5cbc4e8774599f351e59216 (patch)
tree214525435c077203944fdaa0a273801f5b381aea /src/NameGame.h
parente3b2c19dae58430823913c5b6dc0e45617ca6116 (diff)
downloadtipping-points-f7d2e7c8a70e4d96c5cbc4e8774599f351e59216.tar.gz
tipping-points-f7d2e7c8a70e4d96c5cbc4e8774599f351e59216.tar.bz2
tipping-points-f7d2e7c8a70e4d96c5cbc4e8774599f351e59216.zip
add strategy_record
- src/NameGame.h: add strategy record as vector of tuples. - src/NameGame.cc (runRound): remove each round printout but update the strategy record. - fix speaker memory update. - (clearRecord): add function. - (writeRecord): add function to output CSV file with record info. - (NameGame::run): print average strategy. - src/main.cc: clear memory and run 1000 rounds. - TASKS.md: update tasks Signed-off-by: Aiden Woodruff <woodra@rpi.edu>
Diffstat (limited to 'src/NameGame.h')
-rw-r--r--src/NameGame.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/NameGame.h b/src/NameGame.h
index 8a817ce..73f5630 100644
--- a/src/NameGame.h
+++ b/src/NameGame.h
@@ -2,6 +2,8 @@
2#define TIPPING_POINTS_NAMEGAME_H 2#define TIPPING_POINTS_NAMEGAME_H
3 3
4#include <random> 4#include <random>
5#include <tuple>
6#include <vector>
5 7
6#include <Snap.h> 8#include <Snap.h>
7 9
@@ -15,7 +17,9 @@ public:
15 17
16 void initGraph(); 18 void initGraph();
17 void initMemory(); 19 void initMemory();
20 void clearRecord();
18 void run(int rounds); 21 void run(int rounds);
22 void writeRecord(const char* fname);
19 23
20protected: 24protected:
21 int best_move(int nId) const; 25 int best_move(int nId) const;
@@ -27,6 +31,7 @@ private:
27 std::mt19937 rng; 31 std::mt19937 rng;
28 std::uniform_int_distribution<> dist; 32 std::uniform_int_distribution<> dist;
29 TNodeNet<TPair<TBool, TIntV>> graph; 33 TNodeNet<TPair<TBool, TIntV>> graph;
34 std::vector<std::tuple<int, int, int, int> > strategy_record;
30}; // class NameGame 35}; // class NameGame
31 36
32} // namespace tp 37} // namespace tp