diff --git a/snakes_and_ladders.py b/snakes_and_ladders.py new file mode 100644 index 0000000000000000000000000000000000000000..68709c9f5c755fd41bb8c0f00ab2e9da7aa4f13c --- /dev/null +++ b/snakes_and_ladders.py @@ -0,0 +1,38 @@ +import random +from pprint import pprint +import numpy as np +# Initialisation du board +g = [[0 for j in range(15)]for i in range(15)] +# pprint(g) + +# Liens entre les cases +for i in range(9): + g[i][i+1]=1 +for i in range(10,14): + g[i][i+1]=1 +g[2][10]=1 +g[9][14]=1 +pprint(g) + +# 3 types de dés +def safe(): + choix = [0,1] + return random.choices(choix,[0.5, 0.5])[0] + +def normal(): + choix = [0,1,2] + return random.choices(choix,[0.33, 0.33, 0.33])[0] + +def risky(): + choix = [0,1,2,3] + return random.choices(choix,[0.25, 0.25, 0.25, 0.25])[0] + + +# markovDecision(layout,circle) + + +np.random.seed(0) +layout = np.ndarray([0, 0, 3, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 1, 0]) +choices = [0,1,2,3] +print(layout) +print(np.linspace(1,15,15, dtype=np.float16))