示例#1
0
 def new(cls, name, **kwargs):
     p = cls(id=default_uuid())
     p.name = name
     p.reset()
     for k, v in kwargs.items():
         setattr(p, k, v)
     return p
示例#2
0
 def add_message(self, timestamp, type, message):
     m = Message(id=default_uuid(),
                 timestamp=timestamp,
                 type=type,
                 message=message)
     self.messages[m.id] = m
     return m
示例#3
0
def get_game():
    db = get_db()
    try:
        game = db['game']
    except KeyError:
        game = Game(default_uuid())
        db['game'] = game

    return db['game']
示例#4
0
    def new(cls, name, **kwargs):
        n = cls(id=default_uuid())
        n.name = name
        #        n.higher_edges = []
        #        n.lower_edges = []
        #        n.wallet = Wallet()

        for k, v in kwargs.items():
            setattr(n, k, v)
        return n
示例#5
0
 def new(cls, name, **kwargs):
     t = cls(id=default_uuid())
     t.name = name
     t.players = set()
     return t
示例#6
0
 def new(cls, player, fundings):
     b = cls(id=default_uuid())
     b.player = player
     b.fundings = fundings
     return b
示例#7
0
 def reset(self):
     self.wallet = Wallet()
     self.token = default_uuid()
     self.goal_id = None
     self.policies = Dict()
示例#8
0
 def new(cls):
     return cls(id=default_uuid())
示例#9
0
 def new(cls, n1, n2, weight):
     e = cls(id=default_uuid())
     return e.init(n1, n2, weight)