def get_max_counter(maze_id): world = db.get_world(maze_id) ret = { "max": world.farm.counter } return json.dumps(ret)
def get_maze(maze_id): world = db.get_world(maze_id) ret = { 'maze' : world.farm.a_svg_maze } return json.dumps(ret)
def get_action(maze_id, action_id): world = db.get_world(maze_id) if action_id > world.client_counter: world.client_counter = action_id db.save_world(maze_id, world) info = db.get_info(maze_id, action_id) print "GETTING", maze_id, action_id return info
def get_action(maze_id,action_id): world = db.get_world(maze_id) if action_id > world.client_counter: world.client_counter = action_id db.save_world(maze_id, world) info = db.get_info(maze_id, action_id) print "GETTING", maze_id, action_id return info
def increment_world(): for key in db.list_worlds(): world = db.get_world(key) # only do work on the server 10 moves ahead of client if world.farm.counter <= 50 + world.client_counter: world.farm.run_farm() db.save_info(world.farm.make_json(), key, world.farm.counter) world.farm.counter += 1 print 'ANT FARM COUNTER: ', world.farm.counter db.save_world(key, world)
def get_maze(maze_id): world = db.get_world(maze_id) ret = {'maze': world.farm.a_svg_maze} return json.dumps(ret)
def get_max_counter(maze_id): world = db.get_world(maze_id) ret = {"max": world.farm.counter} return json.dumps(ret)
def ant_maze(maze_id=0): world = db.get_world(maze_id) return render_template('maze.html', maze_id=maze_id)