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
classGame(object):
""" Environment where everything will works together. This class have only one instance (Singleton Patern) """__instance=None# Private variabledef__new__(cls, *args, **kwargs):
""" Return only one instance of this class. @return Game instance into __instance variable """ifcls.__instanceisNone:
cls.__instance=super(Game, cls).__new__(cls, *args, **kwargs)
returncls.__instance@staticmethoddefget_instance():
""" Return only one instance of this class. @return Game instance into __instance variable """ifGame.__instanceisNone:
Game.__instance=Game()
returnGame.__instance
The text was updated successfully, but these errors were encountered:
The game class must be a Singleton
The text was updated successfully, but these errors were encountered: