From f79696d76109d91c7736f1f3e6eec3364ecb7102 Mon Sep 17 00:00:00 2001 From: Matthew Brennan Date: Wed, 28 Jan 2015 12:44:03 -0500 Subject: [PATCH] added coordination confidence --- main.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/main.cpp b/main.cpp index 212fa6c..a6b36ca 100644 --- a/main.cpp +++ b/main.cpp @@ -29,7 +29,7 @@ vector< set > k_subsets_set(int k, int num){ class RGame { private: GameSpec* spec; - double vconf, mconf; + double vconf, mconf, cconf; map, GameTree*> trees; vector< set > subsets; map, double> prob_map; @@ -38,10 +38,11 @@ class RGame { public: int mission, rpoints, spoints; - RGame(GameSpec* spec, double vconf, double mconf){ + RGame(GameSpec* spec, double vconf, double mconf, double cconf){ this->spec = spec; this->vconf = vconf; this->mconf = mconf; + this->cconf = cconf; mission = 0; rpoints = 0; spoints = 0; @@ -136,6 +137,14 @@ class RGame { } else if (prob_fail + prob_no_fail > 0){ prob_factors[spy_set] = prob_no_fail / (prob_fail + prob_no_fail); } + + // may result in errors (double check this part) + if (num_fails > 0 && find_num_spies(spy_set, most_recent_team) != num_fails){ + prob_factors[spy_set] *= (1 - cconf) + } else { + prob_factors[spy_set] *= cconf; + } + factor_total += prob_factors[spy_set]; } } @@ -215,6 +224,7 @@ void print_statistics(RGame* game, vector player_names){ int main(){ double voting_confidence = 0.1; double mission_confidence = 0.8; + double coord_confidence = 0.8; int num_players = 0; cout << "Welcome to the Resistance Game Calculator developed by Matthew Brennan and Vincent Kee." << endl; @@ -226,7 +236,7 @@ int main(){ } GameSpec* game_spec = new GameSpec(num_players); - RGame* game = new RGame(game_spec, voting_confidence, mission_confidence); + RGame* game = new RGame(game_spec, voting_confidence, mission_confidence, coord_confidence); map name_map; vector player_names;