Example #1
0
def play_for_player(player):
    times = []
    depths = []
    for t in np.linspace(0.1, 3, 50):
        player.set_game_params(ai_board.copy())
        d = player.make_move(t)
        times.append(t)
        depths.append(d)
    plt.scatter(times, depths)
    plt.show()
Example #2
0
ax6.set_ylabel('Best value returned')
ax6.set_title('Best value vs depth')
ax6.grid()

for name, color, player_class in zip(names, colors, player_classes):
    times = []
    depths = []
    branches_pruned = []
    heuristics_used = []
    leaves_developed = []
    max_values = []

    for t in time_arr:
        print(f"time: {round(t,2)}")
        player = player_class()
        player.set_game_params(ai_board.copy())
        # C_CONSTANTS.MAX_GROUND_DISTANCE = player.max_ground_distance

        d, max_val = player.make_move(t)

        times.append(t)
        depths.append(d)
        max_values.append(max_val)

        heuristics_used.append(player.heuristics_used)
        leaves_developed.append(player.leaves_developed)

        if name in ['AlphaBeta', 'OrderedAlphaBeta']:
            branches_pruned.append(player.branches_pruned)

    if name in ['AlphaBeta', 'OrderedAlphaBeta']: