def main(): FORMAT = '%(levelname)7s: %(message)s' logging.basicConfig(level=logging.DEBUG, format=FORMAT) from world import World from dual_world import DualWorld from dict_world import DictWorld from test_emulators import validate_custom, validate #map_name = 'beard1' #map_path = '../data/sample_maps/{}.map'.format(map_name) map_path = '../data/maps_manual/simple_beard.map' world = World.from_file(map_path) world.show() sleep(0.1) # for stdout to flush solver = Solver(world) solver.solve() score, solution = solver.get_best() solver.log_stats() sleep(0.1) # for stderr to flush print '****' print 'Solution:', score, repr(solution) ''' print 'validating...', world = DualWorld.from_file(map_path) for cmd in solution: world = world.apply_command(cmd) if world.terminated: break validated_score = world.score assert score == validated_score, (score, validated_score) ''' #validate(map_name, solution, [World]) validate_custom(map_path, solution, [World])#, DictWorld, DualWorld]) print 'ok'
UUUUUUUULLLLLLLLLLLLLUULUUULLLLLLLLLUULLLRRRDDRRRRRRRDDDDDDDRRRRRRRRRRRRRRRDA ULLDUULLLRRRRRDDDA UUUUUUUULLUULLLUUUUUUUUUUURRLLLLLLLLLLLLLLDDDDDDDDDDDDDDDDDDDDDUUUUUUUUUUUUUUUUUUULLLLA UULLLLLDDLLLLLLLLLLLUUUULLLLLLLUULLLUUUURUURUUUUUUUURA """.split() test_suite = [("contest6", "RUULRRRRRRRRRRUUULLLLLLLDLLLUUUUUURULURR"), ("contest8", "RRRRRRRULD")] test_suite.extend(("contest10", cmd) for cmd in world10_commands) t_start = time.time() # time_execution_print(World, test_suite, chunk_size = 100) # time_execution_print(World, test_suite, chunk_size = 100) # time_execution_print(DictWorld, test_suite, chunk_size = 1) # time_execution_print(DictWorld, test_suite, chunk_size = 1) # time_execution_print(VorberWorld, test_suite, chunk_size = 1) # time_execution_print(VorberWorld, test_suite, chunk_size = 1) # world_classes.remove(VorberWorld) validate_custom("../data/maps_manual/lookahead.map", "LL", [World, VorberWorld]) # map_name = 'flood1' # path = run_interactively(VorberWorld.from_file(official_map_file_name(map_name))) # path = run_interactively(World.from_file(official_map_file_name('beard3'))) # validate('beard3', path, [World, VorberWorld]) # import webvalidator # webvalidator.dump_all_cached_responses()