import random
class Player():
def __init__(self, team, blocker):
self.block = blocker
self.team = team
self.killing = False
self.BP = False
if self.team == "town":
self.BP = True
def __str__(self):
return self.team
def main():
wins = [0,0,0]
n = int(input("How many times would you like it to run?\n"))
scumA = True
scumB = True
players = initPlayers()
done = ""
for i in range(n):
while(done == ""):
if done == "":
players = day(players)
for player in players:
print(str(player))
print()
teams = checkWinCon(players)
done = teams[0]
scumA = teams[1]
scumB = teams[2]
if done == "":
players = night(players, scumA, scumB)
for player in players:
print(str(player))
print()
teams = checkWinCon(players)
done = teams[0]
scumA = teams[1]
scumB = teams[2]
end(done)
if done == "Town":
wins[0] += 1
if done == "Scum A":
wins[1] += 1
if done == "Scum B":
wins[2] += 1
players = initPlayers()
done = ""
print("Town wins: " + str(wins[0]))
print("Scum A wins: " + str(wins[1]))
print("Scum B wins: " + str(wins[2]))
def initPlayers():
players = []
for i in range(4):
players.append(Player("town", False))
players.append(Player("scumA", True))
players.append(Player("scumA", False))
players.append(Player("scumB", True))
players.append(Player("scumB", False))
return players
def day(players):
print("Day")
random.seed()
del players[random.randint(0,len(players)-1)]
return players
def night(players, scumA, scumB):
print("Night")
random.seed()
if scumA:
killerA = findEnemy("scumA", players)
players[killerA].killing = True
if scumB:
killerB = findEnemy("scumB", players)
players[killerB].killing = True
for player in players:
if player.block and not player.killing:
blocked = findEnemy(player.team, players)
players[blocked].killing = False
for player in players:
if player.killing:
target = findEnemy(player.team, players)
players = kill(target, players)
player.killing = False
return players
def checkWinCon(players):
scumA = 0
scumB = 0
Aexists = True
Bexists = True
for player in players:
if player.team == "scumA":
scumA += 1
if player.team == "scumB":
scumB += 1
if scumA == 0:
Aexists = False
if scumB == 0:
Bexists = False
if scumA >= len(players)/2.0:
return ["Scum A", 0, 0]
if scumB >= len(players)/2.0:
return ["Scum B", 0,0]
if scumA == 0 and scumB == 0:
print("sup")
return ["Town", 0,0]
return ["", Aexists, Bexists]
def end(team):
print(team + " wins!\n")
def kill(index, players):
if players[index].BP == True:
players[index].BP = False
print("checkBP")
else:
del players[index]
print("checkNonBP")
return players
def findEnemy(team, players):
random.seed()
enemy = Player("", False)
while(enemy.team == team or enemy.team == ""):
enemy = players[random.randint(0,len(players)-1)]
return players.index(enemy)
main()
Posted: Mon Nov 21, 2016 8:55 am
by Infinity 324
Town wins: 343
Scum A wins: 76
Scum B wins: 81
That's pretty fucking townsided
Posted: Mon Nov 21, 2016 9:15 am
by Infinity 324
Town wins: 1018
Scum A wins: 254
Scum B wins: 228
Which adds up to:
Town wins: 1361
Scum A wins: 330
Scum B wins: 309
Still very townsided
Posted: Mon Nov 21, 2016 9:18 am
by ThinkBig
What would happen if only 2 townies were 1-shot BP?
Posted: Mon Nov 21, 2016 9:20 am
by Infinity 324
I'll test that, but first I'm gonna test what happens at 3:2:2 and no lynch d1
Posted: Mon Nov 21, 2016 9:21 am
by Pine
Ehhh. This takes the human component out of consideration, which I'm never a big fan of. For example, I doubt it considers that shooting someone who doesn't die is effectively a cop inno on that person. I dunno, I'd hesitate to beef up scum anti-Town power much. Maybe make the goon a 1-shot Doctor?
Posted: Mon Nov 21, 2016 9:23 am
by Infinity 324
In post 31, Pine wrote:Ehhh. This takes the human component out of consideration, which I'm never a big fan of. For example, I doubt it considers that shooting someone who doesn't die is effectively a cop inno on that person. I dunno, I'd hesitate to beef up scum anti-Town power much. Maybe make the goon a 1-shot Doctor?
Yeah, that's the issue with EV.
Also going to test what happens when town doesn't lynch until a scum faction is eliminated
Posted: Mon Nov 21, 2016 9:48 am
by Infinity 324
No lynching until 1 scum faction is gone:
Town wins: 1586
Scum A wins: 220
Scum B wins: 194
Which is, interestingly enough, an even higher win percentage than the others. Now, if scum knows town is doing that they'll try to aim at town, making the strategy pretty ineffective, but it's certainly interesting.
Posted: Mon Nov 21, 2016 9:49 am
by ThinkBig
Should the scum team be effective at eliminating two townies, the townies that are left are essentially kingmakers. That's the problem.
Posted: Mon Nov 21, 2016 9:57 am
by Infinity 324
Actually, if town gets lynched in that case then scum have to shoot each other
Very weird but yeah
Posted: Mon Nov 21, 2016 9:59 am
by ThinkBig
Really? How does that work?
Posted: Mon Nov 21, 2016 10:09 am
by Infinity 324
There are 2 possibilities for each scum. Either it gets shot or it doesn't. If it gets shot it loses no matter what. If it doesn't get shot, it's better off shooting the opposing scum because that gets it a win instead of a draw.
But that assumes the townie is confirmed, which isn't necessarily true. Look at this thread for in-depth explanation for that scenario and others