Пример #1
0
 def __init__(self, dispatch, manage, callback):
     self.expected = "Playing bots:"
     self.label = "BOTS"
     Request.__init__(self, dispatch, manage)
     self.answer = defer.Deferred()
     self.answer.addCallback(callback)
     self.send_command("show bots_ready")
Пример #2
0
 def __init__(self, dispatch, manage,):
     self.gnubg = dispatch.get_gnubg()
     self.expected = dispatch.bot_uid
     self._callback = {'evalMWC': self.send_evaluate,
                      }
     self.label = 'MWC'
     Request.__init__(self, dispatch, manage,)
Пример #3
0
 def __init__(self, dispatch, manage, opp, ML, type_of_invitation):
     self.opponent = opp
     self.ML = ML
     self.expected = self.expected_answer(opp, ML, type_of_invitation)
     self.busy = Busy(dispatch, manage, opp, self.expected)
     self.label = "JOIN"
     Request.__init__(self, dispatch, manage)
Пример #4
0
 def __init__(self, dispatch, manage, opponent, invitation):
     self.refusal1 = "** %s is already playing with someone else." % opponent
     self.refusal2 = "** There's no saved match with %s. " "Please give a match length." % opponent
     self.invitation = invitation
     self.label = "BUSY"
     self.sent_request = time.time()
     Request.__init__(self, dispatch, manage)
Пример #5
0
 def __init__(self, dispatch, manage, opponent):
     self.expected = "** Player %s has left the game. " \
                                         "The game was saved." % opponent
     self.label = 'SAVED'
     Request.__init__(
         self,
         dispatch,
         manage,
     )
Пример #6
0
 def __init__(self, dispatch, manage, opponent, ML, resume=False):
     self.gnubg = dispatch.get_gnubg()
     self.opponent = opponent
     self.ML = ML
     self.expected = self.Answer(self.gnubg, opponent, ML, resume)
     self.expected.send_move = self.send_move
     self.label = 'PLAY'
     self.sent_request = time.time()
     Request.__init__(self, dispatch, manage,)
Пример #7
0
 def __init__(self, dispatch, manage, callback, expected="BOTUID"):
     self.expected = expected
     self.callback = callback
     self.label = 'LOGIN'
     Request.__init__(self, dispatch, manage,)
     # Add two more expected messages in case login fails!
     self.login_failed = "** User not known or wrong password."
     self.manage[self.login_failed] = self
     self.logged_in_already = "** Warning: You are already logged in."
     self.manage[self.logged_in_already] = self
Пример #8
0
 def __init__(self, dispatch, manage, opp, ML, type_of_invitation):
     self.opponent = opp
     self.ML = ML
     self.expected = self.expected_answer(opp, ML, type_of_invitation)
     self.busy = Busy(dispatch, manage, opp, self.expected)
     self.label = 'JOIN'
     Request.__init__(
         self,
         dispatch,
         manage,
     )
Пример #9
0
 def __init__(self, dispatch, manage, callback):
     self.expected = "Playing bots:"
     self.label = 'BOTS'
     Request.__init__(
         self,
         dispatch,
         manage,
     )
     self.answer = defer.Deferred()
     self.answer.addCallback(callback)
     self.send_command('show bots_ready')
Пример #10
0
 def __init__(self, dispatch, manage, opponent, invitation):
     self.refusal1 = "** %s is already playing with someone else." % opponent
     self.refusal2 = "** There's no saved match with %s. " \
                                     "Please give a match length." % opponent
     self.invitation = invitation
     self.label = 'BUSY'
     self.sent_request = time.time()
     Request.__init__(
         self,
         dispatch,
         manage,
     )
Пример #11
0
 def __init__(
     self,
     dispatch,
     manage,
 ):
     self.expected = "login: "
     self.label = 'WELCOME'
     Request.__init__(
         self,
         dispatch,
         manage,
     )
Пример #12
0
 def __init__(self, dispatch, manage, opponent, ML, resume=False):
     self.gnubg = dispatch.get_gnubg()
     self.opponent = opponent
     self.ML = ML
     self.expected = self.Answer(self.gnubg, opponent, ML, resume)
     self.expected.send_move = self.send_move
     self.label = 'PLAY'
     self.sent_request = time.time()
     Request.__init__(
         self,
         dispatch,
         manage,
     )
Пример #13
0
 def __init__(self, dispatch, manage, callback, expected="BOTUID"):
     self.expected = expected
     self.callback = callback
     self.label = 'LOGIN'
     Request.__init__(
         self,
         dispatch,
         manage,
     )
     # Add two more expected messages in case login fails!
     self.login_failed = "** User not known or wrong password."
     self.manage[self.login_failed] = self
     self.logged_in_already = "** Warning: You are already logged in."
     self.manage[self.logged_in_already] = self
Пример #14
0
 def __init__(self, dispatch, manage,):
     self.gnubg = dispatch.get_gnubg
     self.expected = dispatch.bot_uid
     self.direction = dispatch.direction
     self._callback = {'double': self.send_double,
                       'move': self.send_move,
                       'take': self.send_take,
                       'accept': self.send_accept,
                       'rejected': self.handle_rejections,
                       'join': self.send_join,
                       'relax': self.send_thanks,
                      }
     self.label = 'TURN'
     self.sent_request = time.time()
     Request.__init__(self, dispatch, manage,)
Пример #15
0
 def __init__(
     self,
     dispatch,
     manage,
 ):
     self.gnubg = dispatch.get_gnubg
     self.expected = dispatch.bot_uid
     self.direction = dispatch.direction
     self._callback = {
         'double': self.send_double,
         'move': self.send_move,
         'take': self.send_take,
         'accept': self.send_accept,
         'rejected': self.handle_rejections,
         'join': self.send_join,
         'relax': self.send_thanks,
     }
     self.label = 'TURN'
     self.sent_request = time.time()
     Request.__init__(
         self,
         dispatch,
         manage,
     )
Пример #16
0
 def __init__(self, dispatch, manage):
     self.expected = "** Registered you as 'mwcEvaluation'"
     self.label = 'REGISTER'
     Request.__init__(self, dispatch, manage,)
Пример #17
0
 def __init__(self, dispatch, manage,):
     self.expected = "The current settings are:"
     self.label = 'TOGGLE'
     Request.__init__(self, dispatch, manage,)
Пример #18
0
 def purge(self,):
     if hasattr(self.dispatch, 'pending_action'):
         del self.dispatch.pending_action
     Request.purge(self)
Пример #19
0
 def __init__(self, dispatch, manage,):
     self.expected = "Settings of variables:"
     self.label = 'SET'
     Request.__init__(self, dispatch, manage,)
Пример #20
0
 def __init__(self, dispatch, manage, opponent):
     self.expected = "** Player %s has left the game. " "The game was saved." % opponent
     self.label = "SAVED"
     Request.__init__(self, dispatch, manage)
Пример #21
0
 def purge(self, ):
     if hasattr(self.dispatch, 'pending_action'):
         del self.dispatch.pending_action
     Request.purge(self)
Пример #22
0
 def __init__(self, dispatch, manage,):
     self.expected = "login: "
     self.label = 'WELCOME'
     Request.__init__(self, dispatch, manage,)