oTree Forum >

How to set a start value for player's payoff?

#1 by james302

Hi all,

I'm having an experiment for players playing several rounds of games. Because it's possible for players to have negative profits, I want them to start with an initial amount of money. I also want to use player's default payoff field, since it is convenient to see the total payment from the payment tab. However, I don't know how I can modify player's start value on the payoff. As I changed the payoff field directly in my init_py file, it will report an error, because payoff filed is already being defined. 

Meanwhile, I don't want to change the participation fee for that because I'd like to have some flexibility on it.

Thanks,
Tom

#2 by Daniel_Frey

When I want to set an initial value for a variable, I use creating_session:

Try this:

def creating_session(subsession: Subsesion):
	for p in subsession.get_players():
		p.payoff = *your value*
		
		
I'm not sure that's the perfect way, but it works for me :)

Write a reply

Set forum username