You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Deck, the method get_perspective fullfills two functions
providing the overall perspective
providing the perspectives of the players
What is returned is decided based on both the signature of the Deck and the specified player. I would change this to two methods, one for each of the functionalities above.
The signature would then only be used as an access control mechanism.
Even without this, the current functionality could be written less concise, but more clear as
if self.__signature == 1:
assert player == 1 or player == None, "You are not allowed to access the game of player 1 trough this state"
return list(self.__p1_perspective)
elif self.__signature == 2:
assert player == 2 or player == None, "You are not allowed to access the game of player 2 trough this state"
return list(self.__p2_perspective)
elif self.__signature == None:
if player is None:
return self.__card_state
else:
if player == 1: return list(self.__p1_perspective)
else: return list(self.__p2_perspective)
else:
raise Exception("Deck.__signature invalid!")
The text was updated successfully, but these errors were encountered:
In
Deck
, the methodget_perspective
fullfills two functionsWhat is returned is decided based on both the signature of the Deck and the specified player. I would change this to two methods, one for each of the functionalities above.
The signature would then only be used as an access control mechanism.
Even without this, the current functionality could be written less concise, but more clear as
The text was updated successfully, but these errors were encountered: