0
def play(player_1_skill, player_1_strength,player_2_skill,player_2_strength,divider,skillmod,strengthmod):
strengthmod = math.floor((abs(player_1_strength - player_2_strength))/divider)
skillmod = math.floor((abs(player_1_skill - player_2_skill))/divider)
die_p1 = r.randint(1,6)
die_p2 = r.randint(1,6)
if player_1_strength > player_2_strength:
print("Player 1 Wins")
player_1_strength = strengthmod + player_1_strength
player_1_skill = skillmod + player_1_skill
player_2_strength = player_2_strength - strengthmod
player_2_skill = player_2_skill - skillmod
elif player_2_strength > player_1_strength:
print("Player 2 Wins")
player_2_strength = strengthmod + player_2_strength
player_2_skill = skillmod + player_2_skill
player_1_strength = player_1_strength - strengthmod
player_1_skill = player_1_skill - skillmod
else:
print("Tie")
print("The skill modifier : "+ str(skillmod))
print("The strength modifier: " + str(strengthmod))
print("Player 1, Your strength is: " + str(player_1_strength))
print("Player 1, Your skill is: " + str(player_1_skill))
print("Player 2, Your strength is: " + str(player_2_strength))
print("Player 2 , Your skill is: " + str(player_2_skill))
return (player_1_strength, player_1_skill, player_2_strength, player_2_skill,skillmod,strengthmod)
play(player_1_skill, player_1_strength,player_2_skill, player_2_strength,divider,skillmod,strengthmod)
play(player_1_skill, player_1_strength,player_2_skill, player_2_strength,divider,skillmod,strengthmod)
戻り値を変数に取り込み、変数を次の関数に渡します。 – AlG