Advertisement
Guest User

Untitled

a guest
Apr 25th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. class Player(object):
  2. def __init__(self):
  3. self.firstword = 'ready'
  4. self.action = 'start'
  5.  
  6. def __getattribute__(self, actionname):
  7. if actionname != object.__getattribute__(self, 'firstword'):
  8. return object.__getattribute__(self, actionname)
  9. return object.__getattribute__(self, 'newaction')
  10.  
  11. def newaction(self, nextact, word):
  12. self.firstword = word
  13. self.action = nextact
  14.  
  15.  
  16. def Play(Game):
  17. play = Player()
  18. while True:
  19. getattr(Game, play.action)(play)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement