<jupyter_start><jupyter_text>Projet Idée 1 : Démineur<jupyter_code>import numpy as np
import random as rd
def initializationRealGrid(n,h,l,x,y): #n nombre de bombes, h hauteur de la grille, l largeur de la grille
    grid = np.zeros([h,l], dtype="int")
    
    #positionnement des bombes
    i = 0
    while i < n:
        xb = rd.randint(0,l-1)
        yb = rd.randint(0,h-1)
        if (xb==x & yb==y)|(xb==x & yb==y-1)|(xb==x & yb==y+1)|(xb==x-1 & yb==y)|(xb==x-1 & yb==y-1)|(xb==x-1 & yb==y+1)|(xb==x+1 & yb==y)|(xb==x+1 & yb==y-1)|(xb==x+1 & yb==y+1):
            i=i
        elif grid[yb,xb] != 9:
            grid[yb,xb]=9
            i+=1
    print(grid)
    #écriture des chiffres
    
    #première ligne
    nb=0
    if grid[0,0]!=9:
        if grid[0,1]==9:
            nb+=1
        if grid[1,1]==9:
            nb+=1
        if grid[1,0]==9:
            nb+=1
        grid[0,0]=nb
    nb=0
    if grid[0,l-1]!=9:
        if grid[0,l-2]==9:
            nb+=1
        if grid[1,l-2]==9:
            nb+=1
        if grid[1,l-1]==9:
            nb+=1
        grid[0,l-1]=nb
    for j in range(1,l-1):
        if grid[0,j]!=9:
            nb=0
            if grid[0,j-1]==9:
                nb+=1
            if grid[0,j+1]==9:
                nb+=1
            if grid[1,j-1]==9:
                nb+=1
            if grid[1,j]==9:
                nb+=1
            if grid[1,j+1]==9:
                nb+=1
            grid[0,j]=nb
        
    #dernière ligne
    nb=0
    if grid[h-1,0]!=9:
        if grid[h-1,1]==9:
            nb+=1
        if grid[h-2,1]==9:
            nb+=1
        if grid[h-2,0]==9:
            nb+=1
        grid[h-1,0]=nb
    nb=0
    if grid[h-1,l-1]!=9:
        if grid[h-1,l-2]==9:
            nb+=1
        if grid[h-2,l-2]==9:
            nb+=1
        if grid[h-2,l-1]==9:
            nb+=1
        grid[h-1,l-1]=nb
    for j in range(1,l-1):
        if grid[h-1,j]!=9:
            nb=0
            if grid[h-1,j-1]==9:
                nb+=1
            if grid[h-1,j+1]==9:
                nb+=1
            if grid[h-2,j-1]==9:
                nb+=1
            if grid[h-2,j]==9:
                nb+=1
            if grid[h-2,j+1]==9:
                nb+=1
            grid[h-1,j]=nb
    
    #autres lignes
    for i in range (1,h-1):
        nb=0
        if grid[i,0]!=9:
            if grid[i-1,0]==9:
                nb+=1
            if grid[i-1,1]==9:
                nb+=1
            if grid[i,1]==9:
                nb+=1
            if grid[i+1,1]==9:
                nb+=1
            if grid[i+1,0]==9:
                nb+=1
            grid[i,0]=nb
        nb=0
        if grid[i,l-1]!=9:
            if grid[i-1,l-1]==9:
                nb+=1
            if grid[i-1,l-2]==9:
                nb+=1
            if grid[i,l-2]==9:
                nb+=1
            if grid[i+1,l-2]==9:
                nb+=1
            if grid[i+1,l-1]==9:
                nb+=1
            grid[i,l-1]=nb
        for j in range(1,l-1):
            nb=0
            if grid[i,j] !=9:
                if grid[i-1,j-1]==9:
                    nb+=1
                if grid[i-1,j]==9:
                    nb+=1
                if grid[i-1,j+1]==9:
                    nb+=1
                if grid[i,j-1]==9:
                    nb+=1
                if grid[i,j+1]==9:
                    nb+=1
                if grid[i+1,j-1]==9:
                    nb+=1
                if grid[i+1,j]==9:
                    nb+=1
                if grid[i+1,j+1]==9:
                    nb+=1
                grid[i,j]=nb
        
    return grid
def initializationGamerGrid(h,l):
    grid 
    grid = [["_|" for j in range (l)]for i in range(h)]
    return grid

print(initializationGamerGrid(2,3))
grid = np.array([2,3])
for i in range(2):
    for j in range(3):
        grid[i,j]='_'<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.17983367983367984, 'fraction_numerical': 0.059511434511434515, 'mean_word_length': 1.0771721532649756, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 5, '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': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '308957', 'license': 'Apache-2.0', 'n_tokens_mistral': 1640, 'n_tokens_neox': 1545, 'n_words': 271, 'path': 'Projet/Projet.ipynb', 'repo_name': 'Mariusducactus/evolution', 'size': '3848'}