Exemplo n.º 1
0
def mm_test(landing_height, eroded_cells, row_trans, col_trans, pits, cuml_wells, pit_depth, pit_rows):

    controller = {
        "landing_height": landing_height,
        "eroded_cells": eroded_cells,
        "row_trans": row_trans,
        "col_trans": col_trans,
        "pits": pits,
        "cuml_wells":cuml_wells,
        "pit_depth": pit_depth,
        "pit_rows": pit_rows
    }

    osim = TetrisSimulator(
        controller=controller,
            board=tetris_cow2(),
            curr=all_zoids["L"],
            next=all_zoids["S"],
            show_choice=False,
            show_scores=False,
            show_options=False,
            show_result=False,
            seed=1
    )

    return osim.run()
Exemplo n.º 2
0
        for a in range(0, controllers):
            random_controller = generate_controller(start_controller,
                                                    tolerances,
                                                    rng=rng)
            controller_name = "G" + str(x + 1) + "_" + str(a + 1)

            game_seed = rng.randint(0, 100000)

            sim = TetrisSimulator(controller=random_controller,
                                  show_choice=show_choice,
                                  show_result=show_result,
                                  choice_step=v_step,
                                  name=controller_name,
                                  seed=game_seed)
            sim_result = sim.run(max_eps=episodes, printstep=report_every)

            #session_vars, name, features, controller, vars = False, outs = False
            write_controller(outfile,
                             session_variables,
                             controller_name,
                             features,
                             random_controller,
                             outs=sim_result,
                             game_seed=game_seed,
                             type="search",
                             gen=x + 1,
                             num=a + 1,
                             rep=1)

            results.append([random_controller, sim_result])
Exemplo n.º 3
0
 
 for x in range (0, depth):
     
     #session_vars, name, features, controller, vars = False, outs = False
     
     
     results = []
     
     for a in range(0, controllers):
         random_controller = generate_controller(start_controller, tolerances, rng = rng)
         controller_name = "G" + str(x + 1) + "_" + str(a+1)
         
         game_seed = rng.randint(0,100000)
         
         sim = TetrisSimulator(controller = random_controller, show_choice = show_choice, show_result = show_result, choice_step = v_step, name = controller_name, seed = game_seed)
         sim_result = sim.run(max_eps = episodes, printstep = report_every)
         
         #session_vars, name, features, controller, vars = False, outs = False
         write_controller(outfile, session_variables, controller_name, features, random_controller, 
                         outs = sim_result, game_seed = game_seed, type = "search", gen = x + 1, num = a+1, rep = 1)
         
         results.append([random_controller, sim_result])
         
         
     sorted_results = sorted(results, key=lambda k: k[1][optimize])
     
     #for d in sorted_results:
     #    print d[1]["lines"]
 
     top_results = sorted_results[-survivors:]