User:Roelroscama/creativeIndustries/Game simulations
< User:Roelroscama | creativeIndustries
Revision as of 09:40, 29 May 2013 by Roelroscama (talk | contribs) (Created page with "<source lang="python"> #!/usr/bin/python from random import randint amount_of_players = 1000 player_input = 1 app_winnings = 0 amount_of_games = 1 app = 0 x = dict.fromkeys(...")
#!/usr/bin/python
from random import randint
amount_of_players = 1000
player_input = 1
app_winnings = 0
amount_of_games = 1
app = 0
x = dict.fromkeys(range(1, amount_of_players), 0)
def Lottery():
global app
#the actual lottery
a = randint(1,amount_of_players-1)
#substract 1 from all participants
for value in x:
x[value] -= player_input
#add all the substracted to the lucky one
x[a] += ((len(x)*player_input)-app_winnings)
for person, value in x.iteritems():
print "person no", person, "now has", value
app+=app_winnings
roundno = 0
for i in range(0,amount_of_games):
print "round no", roundno
Lottery()
roundno+=1
print '\n'
print 'earnings for app', app
print '\n'