Skip to content
Extraits de code Groupes Projets
snakes_and_ladders.py 759 octets
Newer Older
  • Learn to ignore specific revisions
  • Nathanaël Kindidi's avatar
    Nathanaël Kindidi a validé
    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))