def get_move(view): global history if history is None: history = History(view) load_prior() else: history.updateStatus(view) learn() # update the prior direction = navigate.goWhere(history, prior) shouldeat = eat.shouldEatOrNot(view, history, prior) time.sleep(0.1) return (direction, shouldeat)