Exemplo n.º 1
0
def __update(game, last_move):
    moves = []
    for move in game.grid.moves:
        movecounter, movename, token, point = move
        if movecounter > last_move:
            moves.append(obfuscate_move(move, game))
    return moves
Exemplo n.º 2
0
def get_complete_state(mongo_id):
    print "=== Get Complete State ==="
    g = load_game(mongo_id)
    return_object = {
        u"width": g.width,
        u"height": g.height,
        # u'tokens': [ token.name() for token in g.tokens ],
        u"success": True,
        u"update": [obfuscate_move(move, g) for move in g.grid.moves],
        u"failureCounter": g.failureCounter,
        u"playable": g.gamestate,
        u"currentToken": g.obfuscateToken(g.currentToken),
    }
    if not g.scramble:
        return_object[u"tokens"] = [token.name() for token in g.tokens]
    return return_object