39 lines
		
	
	
		
			849 B
		
	
	
	
		
			Python
		
	
	
	
	
	
		
		
			
		
	
	
			39 lines
		
	
	
		
			849 B
		
	
	
	
		
			Python
		
	
	
	
	
	
|  | from otree.api import Currency as c, currency_range | ||
|  | from . import pages | ||
|  | from ._builtin import Bot | ||
|  | from .models import Constants | ||
|  | import random | ||
|  | 
 | ||
|  | class PlayerBot(Bot): | ||
|  |     def play_round(self): | ||
|  | 
 | ||
|  | 
 | ||
|  | 
 | ||
|  | 
 | ||
|  |         if self.round_number == 1: | ||
|  |             yield (pages.Bienvenue) | ||
|  |             yield (pages.Introduction, { | ||
|  |                    "r1": 98, | ||
|  |                    "r2":2, | ||
|  |                    "r3":110, | ||
|  |                    "r4":5, | ||
|  |             }) | ||
|  | 
 | ||
|  |         yield (pages.NextPage, { | ||
|  |         }) | ||
|  | 
 | ||
|  |         keep_amount = random.randint(0, self.player.dot1) | ||
|  |         sent_amount = self.player.dot1 - keep_amount | ||
|  | 
 | ||
|  |         yield (pages.Send, { | ||
|  |             "keep_amount": keep_amount, | ||
|  |             "sent_amount": sent_amount, | ||
|  |         }) | ||
|  |         # if self.round_number == 8: | ||
|  |         #     yield (pages.Results, { | ||
|  |         #     }) | ||
|  | 
 | ||
|  | 
 | ||
|  |         #if self.player.id_in_group == 1: | ||
|  | 
 |