<jupyter_start><jupyter_text>Ce notebook contient les expérimentations effectuées afin d'evaluer les performances de chacune des stratégie.<jupyter_code>import numpy as np
from matplotlib import pyplot as plt
%load_ext autoreload
%autoreload 2
import dice_battle_seq as dice_seq
import dice_battle_sim as dice_sim
import print_dice 
from scipy.signal import savgol_filter
np.set_printoptions(suppress=True)<jupyter_output><empty_output><jupyter_text>Performances de la stratégie Optimale face aux autres stratégies  En faisant varier le nombre de points à atteindre pour gagner une partie<jupyter_code>N = np.arange(0,500,2)+10
D = 10
P = dice_seq.probabilities(D)
N1b, r1b = dice_seq.expected_rewards(dice_seq.optimal_strategy,dice_seq.blind_strategy,500,N,D,P)
N1b, r2b = dice_seq.expected_rewards(dice_seq.optimal_strategy,dice_seq.random_strategy,500,N,D,P)
N1b, r3b = dice_seq.expected_rewards(dice_seq.optimal_strategy,dice_seq.optimal_strategy,500,N,D,P)

plt.rcdefaults()
fig, ax = plt.subplots()
y1 = savgol_filter(r1b,51,3)
y2 = savgol_filter(r2b,51,3)
y3 = savgol_filter(r3b,51,3)
ax.plot(N1b, y1, 'b')
ax.plot(N1b,y2, 'r-')
ax.plot(N1b,y3, 'g')
ax.plot(N1b, r1b, label='vs blind')
ax.plot(N1b,r2b, label='vs random')
ax.plot(N1b,r3b, label='vs optimal')
ax.set_xlabel("Nombre de points à atteindre pour gagner la partie (N)")
ax.set_ylabel('esperance de gain')
ax.set_title("Esperance de gain du joueur optimal lorsqu'il entame la partie avec D=10")
plt.legend()
fig.savefig('optVSall_first_N.png')<jupyter_output><empty_output><jupyter_text>En faisant varier le nombre de points à atteindre pour gagner une partie<jupyter_code>D = np.arange(1,101)
N = 100
D1a, d1b = dice_seq.expected_rewards_D(dice_seq.optimal_strategy,dice_seq.blind_strategy,500,N,D)
_, d2b = dice_seq.expected_rewards_D(dice_seq.optimal_strategy,dice_seq.random_strategy,500,N,D)
_, d3b = dice_seq.expected_rewards_D(dice_seq.optimal_strategy,dice_seq.optimal_strategy,500,N,D)
plt.rcdefaults()
fig, ax = plt.subplots()
ax.plot(D1a, d1b, label='vs blind')
ax.plot(D1a,d2b, label='vs random')
ax.plot(D1a,d3b, label='vs optimal')
ax.set_xlabel("Nombre maximum de dés qu'un joueur peut lancer (D)")
ax.set_ylabel('esperance de gain')
ax.set_title("Esperance de gain du joueur optimal lorsqu'il entame la partie avec N=100")
plt.legend()<jupyter_output><empty_output><jupyter_text>Performances de la stratégie Aveugle face aux autres stratégies  En faisant varier le nombre de points à atteindre pour gagner une partie<jupyter_code>N = np.arange(0,500,2)+10
D = 10
P = dice_seq.probabilities(D)
N1b, r1b = dice_seq.expected_rewards(dice_seq.blind_strategy,dice_seq.blind_strategy,500,N,D,P)
N1b, r2b = dice_seq.expected_rewards(dice_seq.blind_strategy,dice_seq.random_strategy,500,N,D,P)
N1b, r3b = dice_seq.expected_rewards(dice_seq.blind_strategy,dice_seq.optimal_strategy,500,N,D,P)
plt.rcdefaults()
fig, ax = plt.subplots()
y1 = savgol_filter(r1b,51,3)
y2 = savgol_filter(r2b,51,3)
y3 = savgol_filter(r3b,51,3)
ax.plot(N1b, y1, 'b')
ax.plot(N1b,y2, 'r-')
ax.plot(N1b,y3, 'g')
ax.plot(N1b, r1b, label='vs blind')
ax.plot(N1b,r2b, label='vs random')
ax.plot(N1b,r3b, label='vs optimal')
ax.set_xlabel("Nombre de points à atteindre pour gagner la partie (N)")
ax.set_ylabel('esperance de gain')
ax.set_title("Esperance de gain du joueur blind lorsqu'il entame la partie avec D=10")
plt.legend()<jupyter_output><empty_output><jupyter_text>En faisant varier le nombre de points à atteindre pour gagner une partie<jupyter_code>D = np.arange(1,101)
N = 100
D1a, c1b = dice_seq.expected_rewards_D(dice_seq.blind_strategy,dice_seq.blind_strategy,500,N,D)
_, c2b = dice_seq.expected_rewards_D(dice_seq.blind_strategy,dice_seq.random_strategy,500,N,D)
_, c3b = dice_seq.expected_rewards_D(dice_seq.blind_strategy,dice_seq.optimal_strategy,500,N,D)

plt.rcdefaults()
fig, ax = plt.subplots()
ax.plot(D1a, c1b, label='vs blind')
ax.plot(D1a,c2b, label='vs random')
ax.plot(D1a,c3b, label='vs optimal')
ax.set_xlabel("Nombre maximum de dés qu'un joueur peut lancer (D)")
ax.set_ylabel('esperance de gain')
ax.set_title("Esperance de gain du joueur blind lorsqu'il entame la partie N=100")
plt.legend()<jupyter_output><empty_output><jupyter_text>Performances de la stratégie Random face aux autres stratégies<jupyter_code>N = np.arange(0,500,2)+10
D = 10
P = dice_seq.probabilities(D)
N1b, r1b = dice_seq.expected_rewards(dice_seq.random_strategy,dice_seq.blind_strategy,500,N,D,P)
N1b, r2b = dice_seq.expected_rewards(dice_seq.random_strategy,dice_seq.random_strategy,500,N,D,P)
N1b, r3b = dice_seq.expected_rewards(dice_seq.random_strategy,dice_seq.optimal_strategy,500,N,D,P)
plt.rcdefaults()
fig, ax = plt.subplots()
y1 = savgol_filter(r1b,51,3)
y2 = savgol_filter(r2b,51,3)
y3 = savgol_filter(r3b,51,3)
ax.plot(N1b, y1, 'b')
ax.plot(N1b,y2, 'r-')
ax.plot(N1b,y3, 'g')
ax.plot(N1b, r1b, label='vs blind')
ax.plot(N1b,r2b, label='vs random')
ax.plot(N1b,r3b, label='vs optimal')
ax.set_xlabel("Nombre de points à atteindre pour gagner la partie (N)")
ax.set_ylabel('esperance de gain')
ax.set_title("Esperance de gain du joueur random lorsqu'il entame la partie avec D=10")
plt.legend()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12911929080747736, 'fraction_numerical': 0.042011948352283675, 'mean_word_length': 7.932874354561101, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '205684', 'license': 'MIT', 'n_tokens_mistral': 2362, 'n_tokens_neox': 2252, 'n_words': 415, 'path': 'code/tests.ipynb', 'repo_name': 'hanouticelina/dice-battle', 'size': '5189'}