#ifndef TIPPING_POINTS_NAMEGAME_H #define TIPPING_POINTS_NAMEGAME_H #include #include #include #include namespace tp { class NameGame { public: NameGame(int group_size, int cm_size, int memory = 12); void setCMsize(int cm_size); void seed(int s); void initGraph(); void initMemory(); void clearRecord(); /** * \brief Run the game. * \return number of non-committed players who would choose the new strategy */ int run(int rounds); void writeRecord(const char* fname, bool append = false); protected: int best_move(int nId); void update_memory(int nId, int strategy); private: void runRound(int r); int gsize, cmsize, memlen; std::mt19937 rng; std::uniform_int_distribution<> dist; TNodeNet> graph; struct Record { int round, speaker, committed, strategy; }; std::vector strategy_record; }; // class NameGame } // namespace tp #endif // TIPPING_POINTS_NAMEGAME_H