aboutsummaryrefslogtreecommitdiffstats
path: root/src/NameGame.h
Commit message (Collapse)AuthorAgeFilesLines
* add confirmation bias and exp weightsAiden Woodruff2025-12-121-1/+2
| | | | | | | | | | - src/NameGame.cc: remove std::map best_move implementation. - add explicit confirmation bias macro. - add default random tie-breaker. - src/many-async.cc: reseed for each committed minority value because entropy may be exhausted. Signed-off-by: Aiden Woodruff <woodra@rpi.edu>
* optimizing manyAiden Woodruff2025-11-271-1/+8
| | | | | | | | | | | | | | | | | - src/NameGame.h: update network to use linked list for memory (given macro). seems to provide ~2x speedup. - src/NameGame.cc: add iterator for TLst type. - add copy constructor and copy assignment operator for TLst that are not defined by the SNAP library. - add TP_BESTMOVE_STATIC to use static array for voting to speed up best_move by ~2x. - add conditional logic in places to allow for A/B testing. - based off testing I can get ~4x total improvement so I think I will make both of these permanent (except maybe leaving in the old unoptimized code in case I want to add multiple strategies). - TASKS.md: update tasks. Signed-off-by: Aiden Woodruff <woodra@rpi.edu>
* change main to one run gameAiden Woodruff2025-11-211-1/+5
| | | | | | | | | | | - src/main.cc: run only one game with prescribed settings and output the number of new strategy plays. - src/NameGame.h: change NameGame::run to return an int which is the number of non-committed players that changed their mind. - src/NameGame.cc (run): do not display average for brevity. - output the uncommitted new strategy plays. Signed-off-by: Aiden Woodruff <woodra@rpi.edu>
* only one strategy per roundAiden Woodruff2025-11-181-1/+1
| | | | | | | | | | | | - src/NameGame.cc (runRound): fixed code so that only speaker chooses a strategy each round. this matches BestResponseNameGame.R - renamed variables to just strategy. - updated record call. - (run): updated average calculation per round. - (writeRecord): updated header and row code. - src/NameGame.h: updated Record struct to remove hearer info. Signed-off-by: Aiden Woodruff <woodra@rpi.edu>
* allow appending to CSV file and use biunit answerAiden Woodruff2025-11-181-2/+2
| | | | | | | | | | | | | | | | | | - src/NameGame.h: add append option to writeRecord to allow updating one big CSV file. - add speaker and hearer type (i.e. committed) to CSV file. - src/NameGame.cc (initMemory): change answers to biunit i.e. -1 and 1 for easier analysis. - (runRound): write speaker/hearer type. - (writeRecord): add append mode to allow updating a single CSV file. - had to change to fstream with in/out because using an ofstream always overwrote the file. - only write the header line when at the beginning of the file. - add speaker/hearer type. - src/main.cc: clear record again in each loop and go into append mode for every iteration after the first one. Signed-off-by: Aiden Woodruff <woodra@rpi.edu>
* add namegame parameters to record fileAiden Woodruff2025-11-181-2/+5
| | | | | | | | | | | | | | | - src/NameGame.h: replace tuple in strategy_record with private struct. - src/NameGame.cc (runRound): add round number so it can be written to the strategy record. - change record update for struct and add round number. - use push_back and initializer list. - (run): does not assume record is empty when calculating average. - call runRound with round number. - use struct instead of tuple. - (writeRecord): write NameGame parameters and round number as well. - src/main.cc: don't clear record and write entire record to file. Signed-off-by: Aiden Woodruff <woodra@rpi.edu>
* add strategy_recordAiden Woodruff2025-11-161-0/+5
| | | | | | | | | | | | | | - 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>
* created encapsulated NameGame classAiden Woodruff2025-11-141-0/+34
- src/CMakeLists.txt: add NameGame.cc. - src/NameGame.cc: move best_move, update_memory, run round, round into this class and file. - move begin/end for TVec here. - add initGraph and initMemory for changing sizes. - src/NameGame.h: add class declaration. - main.cc: move all functions out of here. - use one object and re initialize memory for different committed minority sizes. Signed-off-by: Aiden Woodruff <woodra@rpi.edu>