Exemple #1
0
    def __init__ (self, gamemodel, ichandle, gameno, color, name, icrating=None):
        Player.__init__(self)
        self.offers = {}
        self.queue = Queue()
        self.okqueue = Queue()
        self.setName(name)
        self.ichandle = ichandle
        self.icrating = icrating
        self.color = color
        self.gameno = gameno
        self.gamemodel = gamemodel

        # If some times later FICS creates another game with same wplayer,bplayer,gameno
        # this will change to False and boardUpdate messages will be ignored
        self.current = True

        self.connection = connection = self.gamemodel.connection
        self.connections = connections = defaultdict(list)
        connections[connection.bm].append(connection.bm.connect_after("boardUpdate", self.__boardUpdate))
        connections[connection.bm].append(connection.bm.connect_after("playGameCreated", self.__playGameCreated))
        connections[connection.bm].append(connection.bm.connect_after("obsGameCreated", self.__obsGameCreated))
        connections[connection.om].append(connection.om.connect("onOfferAdd", self.__onOfferAdd))
        connections[connection.om].append(connection.om.connect("onOfferRemove", self.__onOfferRemove))
        connections[connection.om].append(connection.om.connect("onOfferDeclined", self.__onOfferDeclined))
        connections[connection.cm].append(connection.cm.connect("privateMessage", self.__onPrivateMessage))
Exemple #2
0
    def __init__(self,
                 gamemodel,
                 ichandle,
                 gameno,
                 color,
                 name,
                 icrating=None):
        Player.__init__(self)
        self.offers = {}
        self.setName(name)
        self.ichandle = ichandle
        self.icrating = icrating
        self.color = color
        self.gameno = gameno
        self.gamemodel = gamemodel
        self.pass_interrupt = False
        self.turn_interrupt = False

        self.connection = connection = self.gamemodel.connection

        self.connections = connections = defaultdict(list)
        connections[connection.om].append(connection.om.connect(
            "onOfferAdd", self.__onOfferAdd))
        connections[connection.om].append(connection.om.connect(
            "onOfferRemove", self.__onOfferRemove))
        connections[connection.om].append(connection.om.connect(
            "onOfferDeclined", self.__onOfferDeclined))
        connections[connection.cm].append(connection.cm.connect(
            "privateMessage", self.__onPrivateMessage))

        self.cid = self.gamemodel.connect_after("game_terminated", self.on_game_terminated)
Exemple #3
0
    def __init__(self,
                 gamemodel,
                 ichandle,
                 gameno,
                 color,
                 name,
                 icrating=None):
        Player.__init__(self)
        self.offers = {}
        self.setName(name)
        self.ichandle = ichandle
        self.icrating = icrating
        self.color = color
        self.gameno = gameno
        self.gamemodel = gamemodel
        self.pass_interrupt = False
        self.turn_interrupt = False

        self.connection = connection = self.gamemodel.connection

        self.connections = connections = defaultdict(list)
        connections[connection.om].append(
            connection.om.connect("onOfferAdd", self.__onOfferAdd))
        connections[connection.om].append(
            connection.om.connect("onOfferRemove", self.__onOfferRemove))
        connections[connection.om].append(
            connection.om.connect("onOfferDeclined", self.__onOfferDeclined))
        connections[connection.cm].append(
            connection.cm.connect("privateMessage", self.__onPrivateMessage))

        self.cid = self.gamemodel.connect_after("game_terminated",
                                                self.on_game_terminated)
    def __init__(self, gmwidg, color, name, ichandle=None, icrating=None):
        Player.__init__(self)

        self.defname = "Human"
        self.board = gmwidg.board
        self.gmwidg = gmwidg
        self.gamemodel = self.gmwidg.gamemodel
        self.move_queue = asyncio.Queue()
        self.color = color

        self.board_cids = [
            self.board.connect("piece_moved", self.piece_moved),
            self.board.connect("action", self.emit_action),
        ]
        self.setName(name)
        self.ichandle = ichandle
        self.icrating = icrating

        self.timemodel_cid = None
        if self.gamemodel.timed:
            self.timemodel_cid = self.gamemodel.timemodel.connect(
                "zero_reached", self.zero_reached
            )
        self.cid = self.gamemodel.connect_after(
            "game_terminated", self.on_game_terminated
        )
Exemple #5
0
 def __init__ (self, gmwidg, color, name, ichandle=None, icrating=None):
     Player.__init__(self)
     
     self.defname = "Human"
     self.board = gmwidg.board
     self.gmwidg = gmwidg
     self.gamemodel = self.board.view.model
     self.queue = Queue()
     self.color = color
     self.conid = [
         self.board.connect("piece_moved", self.piece_moved),
         self.board.connect("action", lambda b,action,param: self.emit_action(action, param))
     ]
     self.setName(name)
     self.ichandle = ichandle
     self.icrating = icrating
     
     if self.gamemodel.timed:
         self.gamemodel.timemodel.connect('zero_reached', self.zero_reached)
Exemple #6
0
 def __init__ (self, gmwidg, color, name, ichandle=None, icrating=None):
     Player.__init__(self)
     
     self.defname = "Human"
     self.board = gmwidg.board
     self.gmwidg = gmwidg
     self.gamemodel = self.board.view.model
     self.queue = Queue()
     self.color = color
     self.conid = [
         self.board.connect("piece_moved", self.piece_moved),
         self.board.connect("action", lambda b,action,param: self.emit_action(action, param))
     ]
     self.setName(name)
     self.ichandle = ichandle
     self.icrating = icrating
     
     if self.gamemodel.timed:
         self.gamemodel.timemodel.connect('zero_reached', self.zero_reached)
Exemple #7
0
    def __init__(self,
                 gamemodel,
                 ichandle,
                 gameno,
                 color,
                 name,
                 icrating=None):
        Player.__init__(self)
        self.offers = {}
        self.setName(name)
        self.ichandle = ichandle
        self.icrating = icrating
        self.color = color
        self.gameno = gameno
        self.gamemodel = gamemodel
        self.turn_interrupt = False

        # If some times later FICS creates another game with same wplayer,bplayer,gameno
        # this will change to False and boardUpdate messages will be ignored
        self.current = True

        self.connection = connection = self.gamemodel.connection

        self.connections = connections = defaultdict(list)
        connections[connection.bm].append(
            connection.bm.connect_after("playGameCreated",
                                        self.__playGameCreated))
        connections[connection.bm].append(
            connection.bm.connect_after("obsGameCreated",
                                        self.__obsGameCreated))
        connections[connection.om].append(
            connection.om.connect("onOfferAdd", self.__onOfferAdd))
        connections[connection.om].append(
            connection.om.connect("onOfferRemove", self.__onOfferRemove))
        connections[connection.om].append(
            connection.om.connect("onOfferDeclined", self.__onOfferDeclined))
        connections[connection.cm].append(
            connection.cm.connect("privateMessage", self.__onPrivateMessage))

        self.cid = self.gamemodel.connect_after("game_terminated",
                                                self.on_game_terminated)
Exemple #8
0
    def __init__(self, gmwidg, color, name, ichandle=None, icrating=None):
        Player.__init__(self)

        self.defname = "Human"
        self.board = gmwidg.board
        self.gmwidg = gmwidg
        self.gamemodel = self.gmwidg.gamemodel
        self.queue = Queue()
        self.color = color

        self.board_cids = [
            self.board.connect("piece_moved", self.piece_moved),
            self.board.connect("action", self.emit_action)
        ]
        self.setName(name)
        self.ichandle = ichandle
        self.icrating = icrating

        if self.gamemodel.timed:
            self.timemodel_cid = self.gamemodel.timemodel.connect('zero_reached', self.zero_reached)
        self.cid = self.gamemodel.connect_after("game_terminated", self.on_game_terminated)
Exemple #9
0
 def __init__ (self, gamemodel, ichandle, gameno, color, name, icrating=None):
     Player.__init__(self)
     
     self.queue = Queue()
     self.okqueue = Queue()
     
     self.setName(name)
     self.ichandle = ichandle
     self.icrating = icrating
     self.color = color
     self.gameno = gameno
     self.gamemodel = gamemodel
     self.connection = connection = self.gamemodel.connection
     
     self.connections = connections = defaultdict(list)
     connections[connection.bm].append(connection.bm.connect_after("boardUpdate", self.__boardUpdate))
     connections[connection.om].append(connection.om.connect("onOfferAdd", self.__onOfferAdd))
     connections[connection.om].append(connection.om.connect("onOfferRemove", self.__onOfferRemove))
     connections[connection.om].append(connection.om.connect("onOfferDeclined", self.__onOfferDeclined))
     connections[connection.cm].append(connection.cm.connect("privateMessage", self.__onPrivateMessage))
     
     self.offers = {}
Exemple #10
0
 def __init__(self):
     Player.__init__(self)
     self.Q = Queue()
     self.__type__ = LOCAL
Exemple #11
0
 def __init__(self):
     Player.__init__(self)
     self.Q = Queue()
     self.__type__ = LOCAL
 def __init__(self):
     Player.__init__(self)
     self.Q = Queue.Queue()
Exemple #13
0
 def __init__(self):
     Player.__init__(self)
     self.Q = Queue.Queue()