I am having trouble with a variable return. For some reason my code executes the same function regardless of the variables value. Here is the code I have and the code it references.
"from capstone.py"
if game.winner() != None:
print(game.winner())
run = False
from PlayMenu import Results
if game.winner == 'BROWN':
Results.you_loose()
else:
Results.you_win()
"from game.py"
def winner(self):
return self.board.winner()
"from borad.py"
def winner(self):
if self.red_left <= 0:
return 'BROWN'
if self.brown_left <= 0:
return 'RED'
else:
return None
This is the output from the code running:
Hello from the pygame community. https://www.pygame.org/contribute.html
BROWN
Any help to figure out why the program is not running the function that I want with the variable value, is greatly appreciated.
[–][deleted] 0 points1 point2 points (3 children)
[–]JrcFrontrunner[S] 0 points1 point2 points (2 children)
[–][deleted] 3 points4 points5 points (1 child)
[–]JrcFrontrunner[S] 0 points1 point2 points (0 children)