Esempio n. 1
0
def load_game(mongo_id):
    if mongo_id == None:
        raise Exception("mongo_id is required")
    g = Game()
    g.mongo_id = mongo_id
    g.load()
    return g
Esempio n. 2
0
def start_game(width=10, height=10, gametype="Default", ntokens=8, nturns=10, scramble=False):
    print "=== Start Game === "
    if width == None:
        width = 10
    if height == None:
        height = 10
    if gametype == None:
        gametype = "Default"
    if ntokens == None:
        ntokens = 8
    if nturns == None:
        nturns = 10
    if scramble == None:
        scramble = False
    g = Game()
    g.generate(width, height, gametype, ntokens, nturns, scramble)
    g.save()
    return str(g.mongo_id)