Sorry for not giving enough info on the problem. I have 3 files in replit, one being RPS_game, that has the code that simulates the games of RPS, those being a function called play that compare the option selected and determines who won the round and returns number of wins and winrate and then some players defined that use different algorithms. Another file is the RPS file which is the file where I have to program the algorithm to beat the rest of the players. Finally I have the main file that calls the function play from RPS_game giving as a parameters both players, one from RPS_game and the other being the player i have to program from the RPS file. To solve the problem i need to identify what player i am against, looking at the function of play in RPS_play i saw that player2 variable was passed as a parameter but in the code it doesnt assign a value to it. This is every line of code where the variable player2 is used in the function play
def play(player1, player2, num_games, verbose=False):
p1_prev_play = ""
p2_prev_play = ""
results = {"p1": 0, "p2": 0, "tie": 0}
for _ in range(num_games):
p1_play = player1(p2_prev_play)
p2_play = player2(p1_prev_play)
I've tried to import the function to my piece of code and assign to a local variable the value of the funtcion:
from RPS_game import play
player2=play.player2
if player2 =='quincy' or player2 =='kris':
but it gives me this error:
AttributeError: 'function' object has no attribute 'player2'
So i dont know how to get the info of what opponent i have right now to use an if statement. Hope this clarifies my problem.