From ad79ed5bcc1af2c67c9ce6700ceb2fad4662c556 Mon Sep 17 00:00:00 2001 From: Nathanael <nathanael.kindidi@student.uclouvain.be> Date: Mon, 8 Apr 2024 18:09:59 +0200 Subject: [PATCH] =?UTF-8?q?D=C3=A9but=201er=20projet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- snakes_and_ladders.py | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 snakes_and_ladders.py diff --git a/snakes_and_ladders.py b/snakes_and_ladders.py new file mode 100644 index 0000000..68709c9 --- /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)) -- GitLab