def test_serialization(self): self.info.update_by_pay(100) self.info.update_to_allin() serial = self.info.serialize() restored = PayInfo.deserialize(serial) self.eq(100, restored.amount) self.eq(PayInfo.ALLIN, restored.status)
def test_serialization(self): self.info.update_by_pay(100) self.info.update_to_allin() serial = self.info.serialize() restored = PayInfo.deserialize(serial) self.eq(100, restored.amount) self.eq(PayInfo.ALLIN, restored.status)
def deserialize(self, serial): hole = [Card.from_id(cid) for cid in serial[3]] player = self(serial[1], serial[2], serial[0]) if len(hole) != 0: player.add_holecard(hole) player.action_histories = serial[4] player.pay_info = PayInfo.deserialize(serial[5]) player.round_action_histories = serial[6] return player
def deserialize(self, serial): hole = [Card.from_id(cid) for cid in serial[3]] player = self(serial[1], serial[2], serial[0]) if len(hole)!=0: player.add_holecard(hole) player.action_histories = serial[4] player.pay_info = PayInfo.deserialize(serial[5]) player.round_action_histories = serial[6] return player
def deserialize(self, serial): hole = [cid for cid in serial[3]] player = self(serial[1], serial[2], serial[0]) if len(hole) != 0: player.add_holecard(hole) player.action_histories = serial[4] player.pay_info = PayInfo.deserialize(serial[5]) player.round_action_histories = serial[6] player.cashgame_stack = serial[7] return player