User:Roelroscama/creativeIndustries/Game simulations

From XPUB & Lens-Based wiki

Lottery Models:

All chip in, one is paid. The facilitator is also paid (makes facilitator the big winner).

#!/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'