from . import *
import time
class PlayerBot(Bot):
def play_round(self):
if self.group.GroupAcknowledgement == 0:
#
# Possibility of not finding a new distribution is not played here
try:
unanimous_choice_corr = self.session.config.get("bot_rej_choicecorr",
int(True))
except KeyError:
if (self.group.id_in_subsession % 2) == 0:
unanimous_choice_corr = 1 # Even group numbers need a second try
else:
unanimous_choice_corr = 0 # Uneven group numbers do not need a second try
if unanimous_choice_corr == 1: # Do the group agree on a new distribution on the second try?
unanimous_choice = 0 # Do the group agree on a new distribution on the first try?
else:
unanimous_choice = 1 # Do the group agree on a new distribution on the first try?
#
# Intro
yield Rej_1_Intro
# Arguments input
if self.session.vars['do_arguments_rejection']:
time.sleep(2) # Sleep for x seconds
yield Submission(Rej_2_Arg, {
"iTokenAddSuggestion_1": C.TOKEN_ADD_TOTAL,
"iTokenAddSuggestion_2": 0,
"iTokenAddSuggestion_3": 0,
"iTokenAddSuggestion_4": 0,
"iTokenAddSuggestion_5": 0,
"Rej_Arg": "xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx "
"xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx "
"xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx "
"xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx "
"xxx xxx xxx xxx xxx xxx xxx xxx xxx xx"},
check_html=False)
#
# Here, no argument gets accepted
if self.session.vars['do_arguments_rejection'] and self.session.vars['do_acceptance']:
field_list = []
for i in range(1, 6):
if self.player.GroupRank != i:
field_list.append("Rej_ArgAkz_" + str(i))
dict_ = {i: 0 for i in field_list}
time.sleep(2) # Sleep for x seconds
yield Submission(Rej_3_RateBestArg, dict_, check_html=False)
#
#
# Here, no argument gets voted the best (unvalid entry!)
if self.session.vars['do_arguments_rejection']:
if self.player.GroupRank != 1:
# Everyone except 1 thinks that Player 1 made the best argument
dict_ = {"Rej_ArgBest_1": 1,
"Rej_ArgBest_2": 0,
"Rej_ArgBest_3": 0,
"Rej_ArgBest_4": 0,
"Rej_ArgBest_5": 0
}
else:
dict_ = {"Rej_ArgBest_1": 0,
"Rej_ArgBest_2": 1,
"Rej_ArgBest_3": 0,
"Rej_ArgBest_4": 0,
"Rej_ArgBest_5": 0
}
time.sleep(2) # Sleep for x seconds
yield Submission(Rej_3_RateBestArg2, dict_, check_html=False)
#
# Overview of best arguments
if self.session.vars['do_arguments_rejection']:
time.sleep(2) # Sleep for x seconds
yield Rej_4_BestUebersicht
# Chat - first try
#
time.sleep(2) # Sleep for x seconds
# Unanimous
if unanimous_choice == 1:
yield Submission(Rej_5_Chat_DistributionProcedure_1, {
"iTokenAddVoteFor_1": C.TOKEN_ADD_TOTAL/2,
"iTokenAddVoteFor_2": C.TOKEN_ADD_TOTAL/2,
"iTokenAddVoteFor_3": 0,
"iTokenAddVoteFor_4": 0,
"iTokenAddVoteFor_5": 0}, check_html=False)
# Not unanimous:
elif unanimous_choice == 0:
if self.player.id_in_group == 1:
yield Submission(Rej_5_Chat_DistributionProcedure_1, {
"iTokenAddVoteFor_1": C.TOKEN_ADD_TOTAL,
"iTokenAddVoteFor_2": 0,
"iTokenAddVoteFor_3": 0,
"iTokenAddVoteFor_4": 0,
"iTokenAddVoteFor_5": 0}, check_html=False)
elif self.player.id_in_group == 2:
yield Submission(Rej_5_Chat_DistributionProcedure_1, {
"iTokenAddVoteFor_1": 0,
"iTokenAddVoteFor_2": C.TOKEN_ADD_TOTAL,
"iTokenAddVoteFor_3": 0,
"iTokenAddVoteFor_4": 0,
"iTokenAddVoteFor_5": 0}, check_html=False)
elif self.player.id_in_group == 3:
yield Submission(Rej_5_Chat_DistributionProcedure_1, {
"iTokenAddVoteFor_1": 0,
"iTokenAddVoteFor_2": 0,
"iTokenAddVoteFor_3": C.TOKEN_ADD_TOTAL,
"iTokenAddVoteFor_4": 0,
"iTokenAddVoteFor_5": 0}, check_html=False)
elif self.player.id_in_group == 4 or self.player.id_in_group == 5:
yield Submission(Rej_5_Chat_DistributionProcedure_1, {
"iTokenAddVoteFor_1": 0,
"iTokenAddVoteFor_2": 0,
"iTokenAddVoteFor_3": 0,
"iTokenAddVoteFor_4": 0,
"iTokenAddVoteFor_5": C.TOKEN_ADD_TOTAL}, check_html=False)
# Election results
time.sleep(2) # Sleep for x seconds
yield Rej_6_Voting_Results
#
# Correction chat
#
time.sleep(2) # Sleep for x seconds
if self.group.found_new_distribution == 0: # unanimous_choice = 0
#
# Unanimous
if unanimous_choice_corr == 1:
yield Submission(Rej_8_Chat_DistributionProcedureKorr_1, {
"iTokenAddVoteFor_corr_1": 0,
"iTokenAddVoteFor_corr_2": C.TOKEN_ADD_TOTAL/2,
"iTokenAddVoteFor_corr_3": C.TOKEN_ADD_TOTAL/2,
"iTokenAddVoteFor_corr_4": 0,
"iTokenAddVoteFor_corr_5": 0}, check_html=False)
# Not unanimous:
if unanimous_choice_corr == 0:
if self.player.id_in_group == 1:
yield Submission(Rej_8_Chat_DistributionProcedureKorr_1, {
"iTokenAddVoteFor_corr_1": C.TOKEN_ADD_TOTAL,
"iTokenAddVoteFor_corr_2": 0,
"iTokenAddVoteFor_corr_3": 0,
"iTokenAddVoteFor_corr_4": 0,
"iTokenAddVoteFor_corr_5": 0}, check_html=False)
elif self.player.id_in_group == 2:
yield Submission(Rej_8_Chat_DistributionProcedureKorr_1, {
"iTokenAddVoteFor_corr_1": 0,
"iTokenAddVoteFor_corr_2": C.TOKEN_ADD_TOTAL,
"iTokenAddVoteFor_corr_3": 0,
"iTokenAddVoteFor_corr_4": 0,
"iTokenAddVoteFor_corr_5": 0}, check_html=False)
elif self.player.id_in_group == 3:
yield Submission(Rej_8_Chat_DistributionProcedureKorr_1, {
"iTokenAddVoteFor_corr_1": 0,
"iTokenAddVoteFor_corr_2": 0,
"iTokenAddVoteFor_corr_3": C.TOKEN_ADD_TOTAL,
"iTokenAddVoteFor_corr_4": 0,
"iTokenAddVoteFor_corr_5": 0}, check_html=False)
elif self.player.id_in_group == 4 or self.player.id_in_group == 5:
yield Submission(Rej_8_Chat_DistributionProcedureKorr_1, {
"iTokenAddVoteFor_corr_1": 0,
"iTokenAddVoteFor_corr_2": 0,
"iTokenAddVoteFor_corr_3": 0,
"iTokenAddVoteFor_corr_4": 0,
"iTokenAddVoteFor_corr_5": C.TOKEN_ADD_TOTAL}, check_html=False)
#
# Election results (Correction)
if self.group.found_new_distribution == 0: # unanimous_choice = 0
yield Rej_8_Voting_ResultsKorr
#
# Info on all rounds
time.sleep(2) # Sleep for x seconds # Wait for some seconds to load the picture
if self.group.found_new_distribution == 1 or self.group.found_new_distribution_corr == 1:
yield Rej_9_Rounds1
time.sleep(2) # Sleep for x seconds # Wait for some seconds to load the picture
if self.group.found_new_distribution == 1 or self.group.found_new_distribution_corr == 1:
yield Rej_9_Rounds2