Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- from random import randint
- import math
- toughness = [50.0, 50.0, 50.0, 50.0, 50.0]
- friendliness = [50.0, 50.0, 50.0, 50.0, 50.0]
- caution = [50.0, 50.0, 50.0, 50.0, 50.0]
- diligence = [50.0, 50.0, 50.0, 50.0, 50.0]
- ambition = [50.0, 50.0, 50.0, 50.0, 50.0]
- combat = [0.0, 0.0, 0.0, 0.0, 0.0]
- fitness = [50.0, 50.0, 50.0, 50.0, 50.0]
- happiness = [50.0, 50.0, 50.0, 50.0, 50.0]
- friendship = [[50.0, 50.0, 50.0, 50.0, 50.0], [50.0, 50.0, 50.0, 50.0, 50.0], [50.0, 50.0, 50.0, 50.0, 50.0], [50.0, 50.0, 50.0, 50.0, 50.0],
- [50.0, 50.0, 50.0, 50.0, 50.0]]
- debt = [[0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0]]
- defense = [0.0, 0.0, 0.0, 0.0, 0.0]
- discreetness = [[50.0, 50.0, 50.0, 50.0, 50.0], [50.0, 50.0, 50.0, 50.0, 50.0], [50.0, 50.0, 50.0, 50.0, 50.0], [50.0, 50.0, 50.0, 50.0, 50.0],
- [50.0, 50.0, 50.0, 50.0, 50.0]]
- money = [0.0, 0.0, 0.0, 0.0, 0.0]
- job = [0.0, 0.0, 0.0, 0.0, 0.0]
- popularFame = [0.0, 0.0, 0.0, 0.0, 0.0]
- criminalFame = [0.0, 0.0, 0.0, 0.0, 0.0]
- crimeLevel = [0.0, 0.0, 0.0, 0.0, 0.0]
- connections = [0.0, 0.0, 0.0, 0.0, 0.0]
- possessions = [0.0, 0.0, 0.0, 0.0, 0.0]
- lost = [False, False, False, False, False]
- winner = -1
- lastFiveA = [[-1, -1, -1, -1, -1], [-1, -1, -1, -1, -1], [-1, -1, -1, -1, -1], [-1, -1, -1, -1, -1], [-1, -1, -1, -1, -1]]
- lastFiveB = [[-1, -1, -1, -1, -1], [-1, -1, -1, -1, -1], [-1, -1, -1, -1, -1], [-1, -1, -1, -1, -1], [-1, -1, -1, -1, -1]]
- lastFiveC = [[-1, -1, -1, -1, -1], [-1, -1, -1, -1, -1], [-1, -1, -1, -1, -1], [-1, -1, -1, -1, -1], [-1, -1, -1, -1, -1]]
- def makePositive():
- for i in range(0,5):
- combat[i] = max(1,min(100,combat[i]))
- fitness[i] = max(1,min(100,fitness[i]))
- happiness[i] = max(1,min(100,happiness[i]))
- for j in range(0,5):
- friendship[i][j] = max(1,min(100,friendship[i][j]))
- debt[i][j] = max(1,min(100,debt[i][j]))
- discreetness[i][j] = max(1,min(100,discreetness[i][j]))
- defense[i] = max(1,min(100,defense[i]))
- money[i] = max(1,min(100,money[i]))
- job[i] = max(1,min(100,job[i]))
- popularFame[i] = max(1,min(100,popularFame[i]))
- criminalFame[i] = max(1,min(100,criminalFame[i]))
- crimeLevel[i] = max(1,min(100,crimeLevel[i]))
- connections[i] = max(1,min(100,connections[i]))
- possessions[i] = max(1,min(100,possessions[i]))
- pops = [[],[],[],[],[]]
- def restart():
- global toughness
- global friendliness
- global caution
- global diligence
- global ambition
- global combat
- global fitness
- global happiness
- global friendship
- global debt
- global defense
- global discreetness
- global money
- global job
- global popularFame
- global criminalFame
- global crimeLevel
- global connections
- global possessions
- global lost
- global winner
- global lastFiveA
- global lastFiveB
- global lastFiveC
- global pops
- pops = [[],[],[],[],[]]
- toughness = [50.0, 50.0, 50.0, 50.0, 50.0]
- friendliness = [50.0, 50.0, 50.0, 50.0, 50.0]
- caution = [50.0, 50.0, 50.0, 50.0, 50.0]
- diligence = [50.0, 50.0, 50.0, 50.0, 50.0]
- ambition = [50.0, 50.0, 50.0, 50.0, 50.0]
- combat = [0.0, 0.0, 0.0, 0.0, 0.0]
- fitness = [50.0, 50.0, 50.0, 50.0, 50.0]
- happiness = [50.0, 50.0, 50.0, 50.0, 50.0]
- friendship = [[50.0, 50.0, 50.0, 50.0, 50.0], [50.0, 50.0, 50.0, 50.0, 50.0], [50.0, 50.0, 50.0, 50.0, 50.0],
- [50.0, 50.0, 50.0, 50.0, 50.0],
- [50.0, 50.0, 50.0, 50.0, 50.0]]
- debt = [[0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0],
- [0.0, 0.0, 0.0, 0.0, 0.0]]
- defense = [0.0, 0.0, 0.0, 0.0, 0.0]
- discreetness = [[50.0, 50.0, 50.0, 50.0, 50.0], [50.0, 50.0, 50.0, 50.0, 50.0], [50.0, 50.0, 50.0, 50.0, 50.0],
- [50.0, 50.0, 50.0, 50.0, 50.0],
- [50.0, 50.0, 50.0, 50.0, 50.0]]
- money = [0.0, 0.0, 0.0, 0.0, 0.0]
- job = [0.0, 0.0, 0.0, 0.0, 0.0]
- popularFame = [0.0, 0.0, 0.0, 0.0, 0.0]
- criminalFame = [0.0, 0.0, 0.0, 0.0, 0.0]
- crimeLevel = [0.0, 0.0, 0.0, 0.0, 0.0]
- connections = [0.0, 0.0, 0.0, 0.0, 0.0]
- possessions = [0.0, 0.0, 0.0, 0.0, 0.0]
- lost = [False, False, False, False, False]
- winner = -1
- lastFiveA = [[-1, -1, -1, -1, -1], [-1, -1, -1, -1, -1], [-1, -1, -1, -1, -1], [-1, -1, -1, -1, -1],
- [-1, -1, -1, -1, -1]]
- lastFiveB = [[-1, -1, -1, -1, -1], [-1, -1, -1, -1, -1], [-1, -1, -1, -1, -1], [-1, -1, -1, -1, -1],
- [-1, -1, -1, -1, -1]]
- lastFiveC = [[-1, -1, -1, -1, -1], [-1, -1, -1, -1, -1], [-1, -1, -1, -1, -1], [-1, -1, -1, -1, -1],
- [-1, -1, -1, -1, -1]]
- def init():
- for i in range (0,5):
- toughness[i] = randint(1,100)
- friendliness[i] = randint(1,100)
- caution[i] = randint(1,100)
- diligence[i] = randint(1,100)
- ambition[i] = randint(1,100)
- okay = False
- while okay == False:
- okay = True
- total = toughness[i] + friendliness[i] + caution[i] + diligence[i] + ambition[i]
- ratio = 250 / total
- toughness[i] *= ratio
- friendliness[i] *= ratio
- caution[i] *= ratio
- diligence[i] *= ratio
- ambition[i] *= ratio
- if toughness[i] > 100 or toughness[i] < 1 or friendliness[i] > 100 or friendliness[i] < 1:
- okay = False
- if caution[i] > 100 or caution[i] < 1 or diligence[i] > 100 or diligence[i] < 1:
- okay = False
- if ambition[i] > 100 or ambition[i] < 1:
- okay = False
- toughness[i] = max(min(toughness[i],95),51)
- friendliness[i] = max(min(friendliness[i],95),5)
- caution[i] = max(min(caution[i],95),5)
- diligence[i] = max(min(diligence[i],95),5)
- ambition[i] = max(min(ambition[i],95),5)
- lossReason = [0,0,0]
- winReason = [0,0,0,0,0,0]
- totalTurns = 0
- totalTicks = [[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
- [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
- [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]]
- def checkForLoss():
- for i in range(0, 5):
- if (lost[i] == False):
- if (crimeLevel[i] > randint(1, 100)): # the cops getcha
- lost[i] = True # current level = 2405
- lossReason[0] += 1
- elif (fitness[i] < 1): # Dead.
- lost[i] = True # current level = 804
- lossReason[1] += 1
- elif (happiness[i] < 1): # suicide.
- lost[i] = True # current level = 62
- lossReason[2] += 1
- turnMultiplier = 1.0
- crimeLevelMultiplier = 1.0
- fitnessMultiplier = 1.0
- happinessMultiplier = 1.0
- popularFameMultiplier = 1.0
- criminalFameMultiplier = 1.0
- moneyMultiplier = 1.0
- friendshipMultiplier = 1.0
- def checkForWin():
- global winner
- if dead() == 5:
- winner=10
- for i in range(0, 5):
- if (lost[i] == False):
- if (popularFame[i] > 100): # won by fame
- winner = i # 6
- winReason[0] += 1
- elif (criminalFame[i] > 100): # won by criminal fame
- winner = i # 16
- winReason[1] += 1
- elif (money[i] > 100): # won by cash
- winner = i # 20
- winReason[2] += 1
- elif (job[i] > 100): # won by CEO
- winner = i # 6
- winReason[3] += 1
- elif dead() == 4: # 51
- winner = i
- winReason[4] += 1
- elif friends(i) == 4:
- winner = i # 0
- winReason[5] += 1
- def friends(i):
- count = 0
- for j in range (0,5):
- if friendship[j][i] > 95 and i != j:
- count+= 1
- return count
- def dead():
- count = 0
- for i in range(0,5):
- if lost[i] == True:
- count += 1
- return count
- # ACTION VS: Results posted in the main chat and seen by all. Can happen completely on their own, but may be chosen.
- # ACTION VS: attacks carry with them a risk of failure, but can have big impacts if successful
- # ACTION VS: helping always succeeds, but with slightly less outcome
- # ACTION VS: These all have dynamic values that change based on the people
- # ACTION WITH: Results MAY be posted in the main chat. Must be chosen and confirmed by both parties to occur.
- # ACTION WITH: challenges have a positive effect for one member, and a negative effect for another member.
- # ACTION WITH: helping actions have positive effects for both parties involved, but do not have as big of impacts
- # ACTION WITH: These all have dynamic values that change based on the people
- # ACTION SELF: Results posted privately. Only you know these changes and their results unless you repeat them yourself
- # ACTION SELF: all actions positive and typically boost stats.
- # ACTION SELF: Everyone MUST get at least one ACTION SELF per turn, and also either one VS or WITH
- # ACTION EVENT: Happens once every three turns. Each player gets an "event" that happens, and must choose how to
- # resolve it. Events may be positive or negative, and the outcome may vary based on your choice of how to resolve it.
- # Events can also potentially involve other people, and can potentially let you change your stats in small amounts
- # PEOPLE THAT CHOOSE TO WATCH THE GAME BUT NOT PLAY: these people get to see everything that goes on, but only via PM
- def lastFive(a,index,player):
- if a == 0:
- for i in range (0,5):
- if lastFiveA[player][i] == index:
- return True
- elif a == 1:
- for i in range (0,5):
- if lastFiveB[player][i] == index:
- return True
- elif a == 2:
- for i in range (0,5):
- if lastFiveC[player][i] == index:
- return True
- return False
- def turn():
- actions()
- checkForLoss()
- checkForWin()
- if winner != -1:
- print("winner: " + str(winner))
- def actions():
- for i in range(0, 5): # for each player
- if lost[i] == False:
- makePositive()
- if i > -1:
- # first, do an actionSelf
- likelyS = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
- likelyS[0] += toughness[i] + randint(-50, 50)
- likelyS[1] += toughness[i] * randint(-50, 50)
- likelyS[2] += friendliness[i] + randint(-50, 50)
- likelyS[3] += friendliness[i] + randint(-50, 50)
- likelyS[4] += caution[i] + randint(-50, 50)
- likelyS[5] += caution[i] + randint(-50, 50)
- likelyS[6] += diligence[i] + randint(-50, 50)
- likelyS[7] += diligence[i] + randint(-50, 50)
- likelyS[8] += ambition[i] + randint(-50, 50)
- likelyS[9] += ambition[i] + randint(-50, 50)
- likelyS[10] += ambition[i] + randint(-50, 50)
- likelyS[11] += ambition[i] + randint(-50, 50)
- likelyS[12] += diligence[i] + randint(-50, 50)
- tops = -100
- topIndex = 0
- for j in range(0, 13):
- if likelyS[j] > tops and lastFive(0, j, i) == False and canExecute(2, j, i, 0):
- topIndex = j
- tops = likelyS[j]
- actionSelf(topIndex, i)
- # next, do an actionVS OR an actionWith
- makePositive()
- if randint(0, 1) == 0:
- likelyS = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
- likelyS[0] += ((101 - friendliness[i]) + toughness[i]) + randint(-100, 100)
- likelyS[1] += ((101 - friendliness[i]) + caution[i]) * randint(-100, 100)
- likelyS[2] += ((101 - friendliness[i]) + diligence[i]) + randint(-100, 100)
- likelyS[3] += ((101 - friendliness[i]) + diligence[i]) + randint(-100, 100)
- likelyS[4] += ((101 - friendliness[i]) + ambition[i]) + randint(-100, 100)
- likelyS[5] += (friendliness[i] + toughness[i]) + randint(-100, 100)
- likelyS[6] += friendliness[i] + randint(-50, 50)
- likelyS[7] += (friendliness[i] + caution[i]) + randint(-50, 50)
- likelyS[8] += (friendliness[i] + caution[i]) + randint(-50, 50)
- likelyS[9] += (friendliness[i] + diligence[i]) + randint(-50, 50)
- likelyS[10] += (friendliness[i] + diligence[i]) + randint(-50, 50)
- likelyS[11] += (friendliness[i] + ambition[i]) + randint(-50, 50)
- likelyS[12] += ((101 - friendliness[i]) + ambition[i]) + randint(-50, 50)
- tops = -100
- topIndex = 0
- k = i
- for j in range(0, 13):
- while k == i or lost[k] == True:
- k = randint(0, 4)
- if likelyS[j] > tops and lastFive(1, j, i) == False and canExecute(2, j, i, k):
- topIndex = j
- tops = likelyS[j]
- actionVS(topIndex, i, k)
- else:
- likelyS = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
- likelyS[0] += toughness[i] + randint(-50, 50)
- likelyS[1] += toughness[i] + randint(-50, 50)
- likelyS[2] += toughness[i] + randint(-50, 50)
- likelyS[3] += toughness[i] + randint(-50, 50)
- likelyS[4] += friendliness[i] + randint(-50, 50)
- likelyS[5] += friendliness[i] + randint(-50, 50)
- likelyS[6] += friendliness[i] + randint(-50, 50)
- likelyS[7] += friendliness[i] + randint(-50, 50)
- likelyS[8] += friendliness[i] + randint(-50, 50)
- likelyS[9] += caution[i] + randint(-50, 50)
- likelyS[10] += caution[i] + randint(-50, 50)
- likelyS[11] += caution[i] + randint(-50, 50)
- likelyS[12] += diligence[i] + randint(-50, 50)
- likelyS[13] += diligence[i] + randint(-50, 50)
- likelyS[14] += diligence[i] + randint(-50, 50)
- likelyS[15] += ambition[i] + randint(-50, 50)
- likelyS[16] += ambition[i] + randint(-50, 50)
- likelyS[17] += ambition[i] + randint(-50, 50)
- tops = -100
- topIndex = 0
- k = i
- for j in range(0, 18):
- while k == i or lost[k] == True:
- k = randint(0, 4)
- if likelyS[j] > tops and lastFive(2, j, i) == False and canExecute(2, j, i, k):
- if randint(0, 1) == 1:
- topIndex = j
- tops = likelyS[j]
- actionWith(topIndex, i, k)
- def canExecute(a,index,p1,p2):
- if a == 0:
- if index == 6:
- if job[p1] > 1:
- return True
- elif index == 8 or index == 10:
- if connections[p1] > 1:
- return True
- elif index == 12:
- if money[p1] > 20:
- return True
- else:
- return True
- elif a == 1:
- if index == 0:
- if happiness[p1] > 10 and fitness[p1] > 10 and randint(1,100) > friendship[p1][p2]:
- return True
- elif index == 1:
- if happiness[p1] > 10 and randint(1,100) > friendship[p1][p2]:
- return True
- elif index == 2 or index == 3:
- if happiness[p1] > 10 and job[p2] > 10 and popularFame[p1] > 10 and randint(1,100) > friendship[p1][p2]:
- return True
- elif index == 4:
- if popularFame[p1] > 10 and happiness[p1] > 10 and connections[p1] > 10 and randint(1,100) > friendship[p1][p2]:
- return True
- elif index == 5:
- if fitness[p2] < 100:
- return True
- elif index == 6:
- if money[p1] > 20:
- return True
- elif index == 9 or index == 11:
- if popularFame[p1] > 10:
- return True
- elif index == 10:
- if debt[p1] > 0 and money[p1] > 10:
- return True
- elif index == 12:
- if popularFame[p1] > 10 and happiness[p1] > 10 and randint(1,100) > friendship[p1][p2]:
- return True
- else:
- return True
- elif a == 2:
- if index == 1:
- if fitness[p1] < 100:
- return True
- elif index == 2:
- if fitness[p1] > 10:
- return True
- elif index == 4:
- if happiness[p1] < 100:
- return True
- elif index == 5:
- if money[p1] > 10 and money[p2] > 10:
- return True
- elif index == 6:
- if happiness[p1] > 10:
- return True
- elif index == 12:
- if money[p1] > 20:
- return True
- elif index == 13:
- if money[p1] > 10 and money[p2] > 10:
- return True
- elif index == 15:
- if criminalFame[p1] > 20:
- return True
- elif index == 16:
- if happiness[p1] > 10 and popularFame[p1] > 10 and money[p1] > 10:
- return True
- elif index == 17:
- if connections[p1] > 10:
- return True
- else:
- return True
- return False
- def actionVS(index, p1, p2):
- # negative actions
- if math.sqrt(randint(1, 100) * diligence[p1]) > (discreetness[p2][p1] / 2):
- if (defense[p2] / 2) < math.sqrt(randint(1, 100) * caution[p1]):
- if index == 0: # fight
- pops[p1].append("1 " + str(index))
- combatDiff = ((combat[p1] - combat[p2]) * random.uniform(0.8, 1.25)) / 2.5
- amount = math.sqrt((101 -friendliness[p1]) * toughness[p1]) / 5
- friendship[p1][p2] -= (amount / 2)
- friendship[p2][p1] -= (amount / 2)
- if combatDiff > 10:
- fitness[p2] -= combatDiff
- happiness[p1] += (combatDiff / 2)
- elif combatDiff > -10:
- happiness[p1] -= (amount / 2)
- happiness[p2] -= (amount / 2)
- else:
- fitness[p1] -= combatDiff
- happiness[p2] += (combatDiff / 4)
- elif index == 1: # prank
- pops[p1].append("1 " + str(index))
- intelligenceDiff = (((ambition[p1]) - ambition[p2]) * random.uniform(0.8, 1.25)) / 2.5
- amount = math.sqrt((101 - friendliness[p1]) * caution[p1]) / 5
- friendship[p2][p1] -= (amount / 2)
- if intelligenceDiff > 10:
- happiness[p2] -= (intelligenceDiff / 2)
- happiness[p1] += (intelligenceDiff / 4)
- elif intelligenceDiff > -10:
- happiness[p1] -= (amount / 2)
- happiness[p2] -= (amount / 2)
- else:
- happiness[p1] -= (intelligenceDiff / 2)
- happiness[p2] += (intelligenceDiff / 8)
- elif index == 2: # get someone demoted
- pops[p1].append("1 " + str(index))
- amount = math.sqrt((101 - friendliness[p1]) * diligence[p1]) / 5
- successChance = (((popularFame[p1]) - popularFame[p2]) * random.uniform(0.8, 1.25)) / 2.5
- friendship[p1][p2] -= (amount / 2)
- friendship[p2][p1] -= (amount / 2)
- if successChance > 10:
- happiness[p2] -= (amount / 2)
- job[p2] -= amount
- elif successChance > -10:
- happiness[p2] -= (amount / 4)
- happiness[p1] -= (amount / 4)
- else: # get in trouble for causing problems
- happiness[p1] -= (amount / 2)
- crimeLevel[p1] += (amount / 4)
- elif index == 3: # steal someone's job, business rivalry, etc
- pops[p1].append("1 " + str(index))
- successChance = (((popularFame[p1]) - popularFame[p2]) * random.uniform(0.8, 1.25)) / 2.5
- amount = math.sqrt((101 - friendliness[p1]) * ambition[p1]) / 5
- friendship[p1][p2] -= (amount / 2)
- friendship[p2][p1] -= (amount / 2)
- if successChance > 10:
- happiness[p2] -= (amount / 2)
- job[p2] -= (amount / 2)
- job[p1] += (amount / 2)
- elif successChance > -10:
- happiness[p1] -= (amount / 4)
- happiness[p2] -= (amount / 4)
- else:
- discreetness[p2][p1] += amount
- happiness[p2] -= (amount / 2)
- elif index == 4: # say something negative about them on TV
- pops[p1].append("1 " + str(index))
- successChance = (((popularFame[p1]) - popularFame[p2]) * random.uniform(0.8, 1.25)) / 2.5
- amount = (101 -friendliness[p1]) / 5
- friendship[p1][p2] -= (amount / 2)
- friendship[p2][p1] -= (amount / 2)
- if successChance > 10:
- popularFame[p2] -= amount
- criminalFame[p2] -= (amount * 2)
- connections[p2] -= amount
- happiness[p2] -= (amount / 2)
- elif successChance > -10:
- happiness[p1] -= (amount / 4)
- happiness[p2] -= (amount / 4)
- else:
- popularFame[p1] -= amount
- criminalFame[p1] -= amount
- connections[p1] -= amount
- happiness[p1] -= (amount / 2)
- elif index == 12: # try to frame someone
- pops[p1].append("1 " + str(index))
- amount = math.sqrt(toughness[p1] * popularFame[p1]) / 5
- rnd = math.sqrt(randint(1, 100) * popularFame[p2])
- if rnd > criminalFame[p1]: # successfully framed them
- happiness[p2] -= (amount / 2)
- friendship[p1][p2] -= (amount / 2)
- friendship[p2][p1] -= (amount / 2)
- crimeLevel[p2] += amount
- elif rnd > criminalFame[p1] / 2: # the cops didn't quite buy it
- happiness[p2] -= (amount / 8)
- friendship[p1][p2] -= (amount / 8)
- friendship[p2][p1] -= (amount / 8)
- crimeLevel[p2] += amount / 4
- else: # the cops think you're up to something
- happiness[p1] -= (amount / 4)
- crimeLevel[p1] += amount / 2
- # positive or neutral actions
- if index == 5: # heal
- pops[p1].append("1 " + str(index))
- amount = math.sqrt(fitness[p1] * friendliness[p1]) / 5
- friendship[p1][p2] += (amount / 2)
- friendship[p2][p1] += (amount / 2)
- fitness[p2] += amount
- elif index == 6: # gift money
- pops[p1].append("1 " + str(index))
- friendship[p1][p2] += friendliness[p1] / 2.5
- friendship[p2][p1] += friendliness[p1] / 2.5
- money[p1] -= friendliness[p1] / 2.5
- money[p2] += friendliness[p1] / 2.5
- elif index == 7: # targeted discreetness, tricking someone into not knowing where you are
- pops[p1].append("1 " + str(index))
- amount = math.sqrt(caution[p1] * (101 -friendliness[p1])) / 5
- discreetness[p1][p2] += amount
- elif index == 8: # figure out where someone lives
- pops[p1].append("1 " + str(index))
- amount = math.sqrt(ambition[p1] * diligence[p1]) / 5
- discreetness[p2][p1] -= amount
- elif index == 9: # get someone promoted
- pops[p1].append("1 " + str(index))
- amount = math.sqrt(friendliness[p1] * popularFame[p1]) / 5
- friendship[p1][p2] += (amount / 2)
- friendship[p2][p1] += (amount / 2)
- happiness[p2] += (amount / 2)
- job[p2] += amount
- elif index == 10: # paying someone back, ONLY if you owe something
- pops[p1].append("1 " + str(index))
- happiness[p2] += (min(debt[p1][p2], money[p1]) / 2)
- friendship[p2][p1] += (min(debt[p1][p2], money[p1]) / 2)
- money[p2] += min(debt[p1][p2], money[p1])
- money[p1] -= min(debt[p1][p2], money[p1])
- debt[p1][p2] -= min(debt[p1][p2], money[p1])
- elif index == 11: # saying something positive about them on TV
- pops[p1].append("1 " + str(index))
- amount = math.sqrt(friendliness[p1] * popularFame[p1]) / 5
- friendship[p1][p2] += (amount / 2)
- friendship[p2][p1] += (amount / 2)
- happiness[p2] += (amount / 2)
- popularFame[p2] += amount
- criminalFame[p2] += amount
- connections[p2] += amount
- def actionWith(index, p1, p2):
- if willParticipate(index, p1, p2):
- if index == 0: # training for combat together
- pops[p1].append("2 " + str(index))
- combat[p1] += 10
- combat[p2] += 10
- friendship[p1][p2] += 5
- friendship[p2][p1] += 5
- elif index == 1: # training fitness together
- pops[p1].append("2 " + str(index))
- fitness[p1] += 10
- fitness[p2] += 10
- friendship[p1][p2] += 5
- friendship[p2][p1] += 5
- elif index == 2: # duel together
- pops[p1].append("2 " + str(index))
- if math.sqrt(toughness[p1] * combat[p1]) > math.sqrt(toughness[p2] * combat[p2]):
- fitness[p2] = 0
- fitness[p1] = fitness[p1] - ((fitness[p1] / 100) * combat[p2])
- else:
- fitness[p1] = 0
- fitness[p2] = fitness[p2] - ((fitness[p2] / 100) * combat[p1])
- elif index == 3: # armwrestle/other cheap combat
- pops[p1].append("2 " + str(index))
- if math.sqrt(toughness[p1] * fitness[p1]) > math.sqrt(toughness[p2] * fitness[p2]):
- happiness[p1] += 5
- money[p1] += 10
- else:
- happiness[p2] += 5
- money[p2] += 10
- elif index == 4: # have fun together
- pops[p1].append("2 " + str(index))
- friendship[p1][p2] += 10
- friendship[p2][p1] += 10
- happiness[p1] += 10
- happiness[p1] += 10
- elif index == 5: # friendly competition
- pops[p1].append("2 " + str(index))
- friendship[p1][p2] += 5
- friendship[p2][p1] += 5
- if math.sqrt(diligence[p1] * caution[p1]) > math.sqrt(diligence[p2] * caution[p2]):
- happiness[p1] += 5
- money[p2] -= 5
- money[p1] += 5
- else:
- happiness[p2] += 5
- money[p1] -= 5
- money[p2] += 5
- elif index == 6: # debate with each other
- pops[p1].append("2 " + str(index))
- outcome = abs(toughness[p1] - toughness[p2]) + abs(diligence[p1] - diligence[p2]) + abs(ambition[p1] - ambition[p2])
- outcome = outcome / 3
- if outcome < 33:
- friendship[p1][p2] += 5
- friendship[p2][p1] += 5
- happiness[p2] += 5
- happiness[p1] += 5
- elif outcome < 67:
- friendship[p1][p2] += 5
- friendship[p2][p1] += 5
- else:
- friendship[p1][p2] -= 5
- friendship[p2][p1] -= 5
- happiness[p2] -= 5
- happiness[p1] -= 5
- elif index == 7: # have a long friendly talk
- pops[p1].append("2 " + str(index))
- friendship[p1][p2] += 10
- friendship[p2][p1] += 10
- elif index == 8: # have a long unfriendly talk
- pops[p1].append("2 " + str(index))
- friendship[p1][p2] -= 10
- friendship[p2][p1] -= 10
- elif index == 9: # trade stealth tips
- pops[p1].append("2 " + str(index))
- friendship[p1][p2] += 5
- friendship[p2][p1] += 5
- discreetness[p1][0] += 2.5
- discreetness[p1][1] += 2.5
- discreetness[p1][2] += 2.5
- discreetness[p1][3] += 2.5
- discreetness[p1][4] += 2.5
- discreetness[p2][0] += 2.5
- discreetness[p2][1] += 2.5
- discreetness[p2][2] += 2.5
- discreetness[p2][3] += 2.5
- discreetness[p2][4] += 2.5
- elif index == 10: # trade stealth tips
- pops[p1].append("2 " + str(index))
- friendship[p1][p2] += 5
- friendship[p2][p1] += 5
- defense[p1] += 10
- defense[p2] += 10
- elif index == 11: # remove stealth from each other
- pops[p1].append("2 " + str(index))
- friendship[p1][p2] += 5
- friendship[p2][p1] += 5
- discreetness[p1][p2] -= 10
- discreetness[p2][p1] -= 10
- elif index == 12: #lend them money so they owe you
- pops[p1].append("2 " + str(index))
- friendship[p2][p1] += 5
- debt[p2][p1] += 20
- money[p2] += 20
- money[p1]-= 20
- elif index == 13: # random function: betting
- pops[p1].append("2 " + str(index))
- if randint(1, 2) == 1:
- money[p2] += 10
- money[p1] -= 10
- else:
- money[p1] += 10
- money[p2] -= 10
- elif index == 14: # give job tips
- pops[p1].append("2 " + str(index))
- friendship[p1][p2] += 5
- friendship[p2][p1] += 5
- job[p1] += 10
- job[p2] += 10
- elif index == 15: #try to pull off a heist
- pops[p1].append("2 " + str(index))
- successChance = math.sqrt(connections[p1] + connections[p2])
- amount = math.sqrt(caution[p1] * caution[p2])
- if successChance > 67:
- money[p1] += 5
- money[p2] += 5
- crimeLevel[p1] += 5
- crimeLevel[p2] += 5
- criminalFame[p1] += connections[p1]
- criminalFame[p2] += connections[p2]
- elif successChance > 33:
- friendship[p1][p2] -= 5
- friendship[p2][p1] -= 5
- discreetness[p2][p1] += 2.5
- discreetness[p1][p2] += 2.5
- else:
- friendship[p1][p2] -= 5
- friendship[p2][p1] -= 5
- crimeLevel[p1] += 10
- crimeLevel[p2] += 10
- criminalFame[p1] -= connections[p2] / 2
- criminalFame[p2] -= connections[p1] / 2
- elif index == 16: # be famous together
- pops[p1].append("2 " + str(index))
- successChance = math.sqrt(connections[p1] + connections[p2])
- amount = math.sqrt(diligence[p1] * diligence[p2])
- if successChance > 67:
- popularFame[p1] += connections[p1] / 2
- popularFame[p2] += connections[p2] / 2
- friendship[p1][p2] += 5
- friendship[p2][p1] += 5
- elif successChance > 33:
- money[p1] -= 10
- money[p2] -= 10
- happiness[p1] -= 5
- happiness[p2] -= 5
- else:
- friendship[p1][p2] -= 5
- friendship[p2][p1] -= 5
- happiness[p1] -= 5
- happiness[p2] -= 5
- popularFame[p1] -= connections[p2] / 4
- popularFame[p2] -= connections[p1] / 4
- elif index == 17: # make each other famous
- pops[p1].append("2 " + str(index))
- popularFame[p1] += connections[p2] / 2
- popularFame[p2] += connections[p1] / 2
- friendship[p1][p2] += 5
- friendship[p2][p1] += 5
- def willParticipate(index, p1, p2):
- willDo = True
- return willDo
- def actionSelf(index, p1):
- if index == 0: # learnmartial
- pops[p1].append("0 " + str(index))
- combat[p1] += 20
- elif index == 1: # train
- pops[p1].append("0 " + str(index))
- fitness[p1] += 20
- elif index == 2: # try to make self happy
- pops[p1].append("0 " + str(index))
- happiness[p1] += 20
- elif index == 3: # try to make friends
- pops[p1].append("0 " + str(index))
- friendship[p1][0] += 5
- friendship[p1][1] += 5
- friendship[p1][2] += 5
- friendship[p1][3] += 5
- friendship[p1][4] += 5
- friendship[0][p1] += 5
- friendship[1][p1] += 5
- friendship[2][p1] += 5
- friendship[3][p1] += 5
- friendship[4][p1] += 5
- elif index == 4: # defenses
- pops[p1].append("0 " + str(index))
- defense[p1] += 20
- elif index == 5: # discreetness
- pops[p1].append("0 " + str(index))
- discreetness[p1][0] += 5
- discreetness[p1][1] += 5
- discreetness[p1][2] += 5
- discreetness[p1][3] += 5
- discreetness[p1][4] += 5
- elif index == 6: # work
- pops[p1].append("0 " + str(index))
- money[p1] += job[p1]
- elif index == 7: # promotion
- pops[p1].append("0 " + str(index))
- job[p1] += 20
- elif index == 8: # criminal activities
- pops[p1].append("0 " + str(index))
- criminalFame[p1] += (connections[p1] * 2)
- crimeLevel[p1] += 10
- elif index == 9: # hide from cops, ONLY if you have a positive crime level
- pops[p1].append("0 " + str(index))
- crimeLevel[p1] -= 20
- elif index == 10: # charity
- pops[p1].append("0 " + str(index))
- popularFame[p1] += connections[p1]
- elif index == 11: # connections
- pops[p1].append("0 " + str(index))
- connections[p1] += 20
- elif index == 12: # buy something for self ONLY IF YOU HAVE THE MONEY
- pops[p1].append("0 " + str(index))
- money[p1] -= 20
- happiness[p1] += 20
- possessions[p1] += 1
- init()
- loops = 0
- while loops < 100:
- loops += 1
- restart()
- while winner == -1:
- turn()
- totalTurns += 1
- if winner < 6:
- for i in range(0,pops.__len__()):
- temp = pops[winner][i]
- totalTicks[int(temp.split()[0])][int((temp.split())[1])] += 1
- print(totalTicks)
- print(lossReason)
- print(winReason)
- print(totalTurns)
- # [[11.0, 140.0, 17.0, 21.0, 23.0, 0.0, 12.0, 9.0, 11.0, 14.0, 15.0, 20.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
- # [6.0, 45.0, 3.0, 18.0, 5.0, 0.0, 0.0, 2.0, 3.0, 3.0, 2.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
- # [6.0, 10.0, 8.0, 5.0, 10.0, 0.0, 7.0, 14.0, 8.0, 12.0, 10.0, 9.0, 0.0, 0.0, 5.0, 0.0, 0.0, 0.0]]
- # [220, 96, 8]
- # [10, 10, 16, 5, 55, 1]
- # 1959
Advertisement
Add Comment
Please, Sign In to add comment