From b36982b65d4d122ab46c1a56dd439991dc74857d Mon Sep 17 00:00:00 2001 From: Barak Michener Date: Mon, 22 Jun 2015 23:49:48 -0400 Subject: [PATCH] first working computation with new model --- games/field6.gm | 24 ++- games/p2 | 450 ++++++++++++++++++++++++++++++++++++++++++++++ models/data_model.py | 7 +- models/dataset.json.gz | Bin 3104440 -> 3104440 bytes models/default_model.py | 6 +- models/probs_from_game.py | 15 +- tim.py | 2 +- 7 files changed, 487 insertions(+), 17 deletions(-) create mode 100644 games/p2 diff --git a/games/field6.gm b/games/field6.gm index b4006ac..f3d52b2 100644 --- a/games/field6.gm +++ b/games/field6.gm @@ -26,6 +26,8 @@ 7 ], "type": "vote", + "proposer": 0, + "voten": 1, "round": 1 }, { @@ -69,6 +71,8 @@ 6 ], "type": "vote", + "proposer": 1, + "voten": 1, "round": 2 }, { @@ -95,6 +99,8 @@ 5 ], "type": "vote", + "proposer": 2, + "voten": 2, "round": 2 }, { @@ -121,6 +127,8 @@ 3 ], "type": "vote", + "proposer": 3, + "voten": 3, "round": 2 }, { @@ -147,6 +155,8 @@ 6 ], "type": "vote", + "proposer": 4, + "voten": 4, "round": 2 }, { @@ -202,6 +212,8 @@ 7 ], "type": "vote", + "proposer": 5, + "voten": 1, "round": 3 }, { @@ -227,6 +239,8 @@ 6, 7 ], + "proposer": 6, + "voten": 2, "type": "vote", "round": 3 }, @@ -253,7 +267,9 @@ 5, 7 ], + "proposer": 7, "type": "vote", + "voten": 3, "round": 3 }, { @@ -280,6 +296,8 @@ 5 ], "type": "vote", + "proposer": 0, + "voten": 4, "round": 3 }, { @@ -335,7 +353,9 @@ 5, 6 ], + "proposer": 1, "type": "vote", + "voten": 1, "round": 4 }, { @@ -382,6 +402,8 @@ 6 ], "type": "vote", + "proposer": 1, + "voten": 1, "round": 5 }, { @@ -403,4 +425,4 @@ "must fail": true, "round": 5 } -] \ No newline at end of file +] diff --git a/games/p2 b/games/p2 new file mode 100644 index 0000000..2ab788c --- /dev/null +++ b/games/p2 @@ -0,0 +1,450 @@ +[ + { + "game_size": 10, + "player_names": {} + }, + { + "type": "vote", + "team": [ + 1, + 7, + 8 + ], + "votes": [ + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0 + ], + "round": 1, + "voten": 1, + "proposer": 8, + "fails required": 1, + "print_order": [ + "team", + "votes", + "round" + ] + }, + { + "type": "vote", + "team": [ + 2, + 7, + 9 + ], + "votes": [ + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1 + ], + "round": 1, + "voten": 2, + "proposer": 9, + "fails required": 1, + "print_order": [ + "team", + "votes", + "round" + ] + }, + { + "type": "vote", + "team": [ + 0, + 5, + 6 + ], + "votes": [ + 1, + 1, + 0, + 1, + 0, + 1, + 1, + 0, + 1, + 0 + ], + "round": 1, + "voten": 3, + "proposer": 0, + "fails required": 1, + "print_order": [ + "team", + "votes", + "round" + ] + }, + { + "type": "mission", + "team": [ + 0, + 5, + 6 + ], + "fails": 1, + "round": 1, + "must fail": false, + "print_order": [ + "team", + "fails", + "must fail", + "round" + ] + }, + { + "type": "vote", + "team": [ + 1, + 3, + 6, + 7 + ], + "votes": [ + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 1, + 0 + ], + "round": 2, + "voten": 1, + "proposer": 1, + "fails required": 1, + "print_order": [ + "team", + "votes", + "round" + ] + }, + { + "type": "vote", + "team": [ + 0, + 1, + 2, + 7 + ], + "votes": [ + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0 + ], + "round": 2, + "voten": 2, + "proposer": 2, + "fails required": 1, + "print_order": [ + "team", + "votes", + "round" + ] + }, + { + "type": "vote", + "team": [ + 0, + 1, + 3, + 4 + ], + "votes": [ + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 1 + ], + "round": 2, + "voten": 3, + "proposer": 3, + "fails required": 1, + "print_order": [ + "team", + "votes", + "round" + ] + }, + { + "type": "vote", + "team": [ + 0, + 4, + 7, + 9 + ], + "votes": [ + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 1, + 1, + 1 + ], + "round": 2, + "voten": 4, + "proposer": 4, + "fails required": 1, + "print_order": [ + "team", + "votes", + "round" + ] + }, + { + "type": "mission", + "team": [ + 0, + 4, + 7, + 9 + ], + "fails": 1, + "round": 2, + "must fail": false, + "print_order": [ + "team", + "fails", + "must fail", + "round" + ] + }, + { + "type": "lady", + "p1": 7, + "p2": 0, + "is good": true, + "round": false, + "print_order": [ + "p1", + "p2", + "round", + "is good" + ] + }, + { + "type": "vote", + "team": [ + 0, + 4, + 5, + 9 + ], + "votes": [ + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0 + ], + "round": 3, + "voten": 1, + "proposer": 5, + "fails required": 1, + "print_order": [ + "team", + "votes", + "round" + ] + }, + { + "type": "vote", + "team": [ + 0, + 3, + 6, + 7 + ], + "votes": [ + 0, + 0, + 0, + 1, + 1, + 0, + 1, + 0, + 0, + 0 + ], + "round": 3, + "voten": 2, + "proposer": 6, + "fails required": 1, + "print_order": [ + "team", + "votes", + "round" + ] + }, + { + "type": "vote", + "team": [ + 0, + 2, + 6, + 7 + ], + "votes": [ + 0, + 1, + 1, + 0, + 1, + 0, + 1, + 1, + 0, + 0 + ], + "round": 3, + "voten": 3, + "proposer": 7, + "fails required": 1, + "print_order": [ + "team", + "votes", + "round" + ] + }, + { + "type": "vote", + "team": [ + 0, + 1, + 8, + 9 + ], + "votes": [ + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 0 + ], + "round": 3, + "voten": 4, + "proposer": 8, + "fails required": 1, + "print_order": [ + "team", + "votes", + "round" + ] + }, + { + "type": "mission", + "team": [ + 0, + 1, + 2, + 9 + ], + "fails": 0, + "round": 3, + "must fail": true, + "print_order": [ + "team", + "fails", + "must fail", + "round" + ] + }, + { + "type": "lady", + "p1": 0, + "p2": 9, + "is good": true, + "round": false, + "print_order": [ + "p1", + "p2", + "round", + "is good" + ] + }, + { + "type": "mission", + "team": [ + 0, + 1, + 2, + 7, + 9 + ], + "fails": 0, + "round": 4, + "must fail": false, + "print_order": [ + "team", + "fails", + "must fail", + "round" + ] + }, + { + "type": "mission", + "team": [ + 0, + 1, + 2, + 3, + 6 + ], + "fails": 0, + "round": 5, + "must fail": true, + "print_order": [ + "team", + "fails", + "must fail", + "round" + ] + } +] \ No newline at end of file diff --git a/models/data_model.py b/models/data_model.py index d3af60d..cc706b0 100644 --- a/models/data_model.py +++ b/models/data_model.py @@ -42,9 +42,9 @@ class DataModel(DefaultModel): elif role == "Percival": roles = [self.player_role(x) for x in team] tc = "" - if "merlin" in roles: + if "Merlin" in roles: tc += "merlin" - if "morgana" in roles: + if "Morgana" in roles: tc += "morgana" if tc == "": tc = "neither" @@ -81,10 +81,13 @@ class DataModel(DefaultModel): else: continue app = approval(data) + if app == 0.0: + continue if vote == 1: total = total * app else: total = total * (1.0 - app) + #print total return total diff --git a/models/dataset.json.gz b/models/dataset.json.gz index c78750072ca164c2209920d677c017b818f61078..9b0c6ed890faf25e7399cfbf27b7a104d4d313df 100644 GIT binary patch delta 160 zcmWN_w++Go002Rm@R*!)u*n%VVi$_9Sb-^!klc79hQP%&m!xTsWQbm2_GIpT{4IMkZqb delta 160 zcmWN_w++Go002Rm@R*!)u*n%VVgi<+_=;_iklc6)Cc?!vm!xTsWQg8j_GIpT{3y_$C