Exemple #1
0
def new_game(configuration=False):
    default = {'default': 'start', 'active': 'true'}
    if not configuration:
        configuration = default
    game = create_game(type='sms')
    print "using configuration: ", configuration
    game.konf.use_dict(configuration)
    game = add_story_to_game(game)
    return game
def new_game(configuration=False):
    default = {"default": "start", "active": "true"}
    if not configuration:
        configuration = default
    game = create_game(type="voice")
    print "using configuration: ", configuration
    game.konf.use_dict(configuration)
    game = add_story_to_game(game)
    return game
def new_game(configuration=False):
    default = {'default': 'start',
               'active': 'true'}
    if not configuration:
        configuration = default
    game = create_game(type='sms')
    print "using configuration: ", configuration
    game.konf.use_dict(configuration)
    game = add_story_to_game(game)
    return game
Exemple #4
0
def play(game, input):
    #FIXME: we shoudn't need to do this each time.
    # Perhaps we create an sms and voice object at the start
    # and pass the approprate one to this function?
    game = add_story_to_game(game)

    player_id = get_id()
    player = players.find_one({'player_id': player_id})
    if player is None:
        new_player = {'player_id': player_id,
                      'state': game.state}
        players.insert(new_player)
        #FIXME: There has to be a way to get this from the .insert call
        player = players.find_one({'player_id': player_id})
    print "PLAYER: ", player
    game.set_state(player['state'])
    game.next(input)
    players.update(player, {'$set': {'state': game.state}})
    return game.response