Live Action Mafia http://mafia.mit.edu/ |
|
A program on probability http://mafia.mit.edu/viewtopic.php?f=368&t=5842 |
Page 1 of 1 |
Author: | ksedlar [ Thu Oct 12, 2017 1:07 pm ] |
Post subject: | A program on probability |
So, I was wondering about pair investigations, and how often they would yield "false guilty" results. So, I wrote a program for simulating investigations of deaths, making the following assumptions - 0 mafia/SK investigators giving results - investigators investigate in sequence, such that the first investigator randomly picks two people from all living players, and subsequent investigators always investigate a random person with the latest not-innocent person (no one investigates cleared people) A "false guilty" result would be produced whenever there was a run of n investigations calling someone not-innocent, where n was set to the "sketch bar" constant. The program would run 100 iterations with 9 investigations per day, then print out how many total instances there were of townies vs mafia hitting the sketch bar. With a sketch bar of 3, there are roughly twice as many instance of townies hitting the sketch bar as there are mafia. With a sketch bar of 4, townies hit the sketch bar 20% more often than mafia. Only with a sketch bar of 5 do we get mafia hitting the sketch bar more often than townies. So even if townie Jackie had personally made 4 investigations calling Pesto not-innocent, with no clearing of him whatsover, it might STILL have been more likely from her perspective that Pesto had not made the kill. And this program is with no mafia throwing in false investigations to clear mafia, or even to make random townies look sketchier, which they are probably doing. tl;dr: It's really easy to overestimate how bad people look from having several investigations on them calling them not-innocent. |
Author: | ksedlar [ Thu Oct 12, 2017 1:14 pm ] |
Post subject: | Re: A program on probability |
Code, if anyone is curious. Sorry for any janky coding: import random SKETCH_BAR = 4 INVESTIGATIONS_PER_DAY = 9 GAME_SIZE = 26 NUM_SAMPLE_ITERATIONS = 100 false_sketch = 0 true_sketch = 0 # run a bunch of trials for j in range (NUM_SAMPLE_ITERATIONS): # make a list of players, with each player referred to by number players = [] for i in range(GAME_SIZE): players.append(i) # pick a random player to be the killer killer = random.randrange(0, GAME_SIZE) freq_dict = {} ## innocents = [] not_innocent = -1 ## innocent = -2 # iterate through the investigations for i in range(INVESTIGATIONS_PER_DAY): # pick a random new candidate to investigate random.shuffle(players) candidates = [] candidates.append(players.pop()) # if it's the first investigation, pick another candidate to investigate if (not_innocent == -1): candidates.append(players.pop()) # on subsequent investigations, investigate the not-innocent person # from the previous investigation else: candidates.append(not_innocent) random.shuffle(candidates) first = candidates.pop() second = candidates.pop() # if the killer was investigated, they'll be not-innocent if first == killer: not_innocent = first ## innocent = second # otherwise a random one of the candidates (let's say the one we picked # second) is not innocent; note that this case covers picking the killer second else: not_innocent = second ## innocent = first ## innocents.append(innocent) # update the frequency dictionary to reflect chains of not-innocence if not_innocent in freq_dict: freq_dict[not_innocent] += 1 else: freq_dict[not_innocent] = 1 # at the end of the day, tally how many people hit the sketch bar and put them in # the appropriate counter variable for i in freq_dict: if freq_dict[i] >=SKETCH_BAR: if i == killer: true_sketch += 1 else: false_sketch += 1 ## print freq_dict ## print killer print false_sketch print true_sketch |
Author: | brunnerj [ Thu Oct 12, 2017 3:55 pm ] |
Post subject: | Re: A program on probability |
The bayesian interpretation: Each monty hall investigation takes two people, and multiplies the odds that one of them did it by 0 and the other by 2. The odds from your prespective someone did it is the product of all the updates and the priors. If we start with uniform priors over 26 people, and clear 9 of them, that leaves 16 left. If only one was found sketchy in a investigation, and there were 3 investigations against them, then the odds are 8:1:1:1...:1, for 8:16 that they did it, or 1/3. For 4 investigations, it becomes 16:16, which is 1/2. At 5, it becomes 32:16=2/3. This is consistent with and explains the simulation. Conclusion from this is that if there are about n equally sketchy people for a kill, it takes O(log n) investigations against a single person to get >1/2 probability they did it. |
Page 1 of 1 | All times are UTC - 5 hours |
Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ |