Forum EduPython

Echanges autour d'EduPython.

Vous n'êtes pas identifié(e).

#1 2023-12-10 17:19:21

gostdeath
Membre
Inscription : 2023-12-10
Messages : 2

problème d'affichage avec le module motpltlib

bonjour c'est ma première fois sur se site
et j'aimerais demander de l'aide avec un code

c'est mon code, il est censé affiché un graphique mais il n'affiche que des lignes du style :
<function evolution_systeme.<locals>.simulation_fleurs at 0x000001FF045FADD0>
et je ne sais pas comment régler ce problème

j'espère une réponse le plus rapidement possible

 
 import random
print(random)

def fleurs(i,j):
    for i in range(31):#indice de colonne = 0-30
        for j in range (31):#indice de ligne = 0-30
            F=300 #nb de fleurs
            M=[]
            F=M[i][j]
            F=M[random.randint(0,30)][random.randint(0,30)]
            return fleurs
print(fleurs)


def escargot(x,y):
    E=100
    E=[(x,y),score_de_sante]
    score_de_sante=10
    x=random.randint(0,30)
    y=random.randint(0,30)
    return escargot
print(escargot)
            

def evolution_systeme(days):
    for days in range(1000):
        
        def simulation_fleurs():
            for i in F>=1:
                a=1 #la nouvelle fleure
                F=F+a[random.randint(i-1,i+1)][random.randint(j-1,i+1)]
            return simulation_fleurs
        print(simulation_fleurs)


        def simulation_escargot():
            for x in E:
                for y in E:
                    E=[(random.randint(x-1,x+1),random.randint(y-1,y+1)),score_de_sante]
                    if (x,y)!=(i,j):
                        score_de_sante=score_de_sante-1
                        if score_de_sante==0:
                            del E
                    elif (x,y)==(i,j):
                        F=F-1
                        if score_de_sante<10:
                            score_de_sante=score_de_sante+1
                        elif score_de_sante==10:
                            bebe=[(x,y),2] #bebe = nouvel escargot
                            E=E+bebe
            return simulation_escargot
        print(simulation_escargot)
    

        def listes(f,e):
            for f in []:
                f=plantes
                plantes=[sum(simulation_fleurs)]
                return plantes

            for e in [] :
                e=animaux
                animaux=[sum(simulation_escargot)]
                return animaux
            
            print(plantes)
            print(animaux)



    return evolution_systeme
evolution_systeme(1000)

        
        
        
        

import matplotlib.pyplot as plt
print(plt)
def afficherEvolution(plantes,animaux):
    plt.plot(animaux, label="animaux", color="red")
    plt.plot(plantes, label="plantes", color="green")
    plt.legend()
    plt.xlabel("Jours")
    plt.ylabel("Nombre d’individus")
    plt.show()

Hors ligne

Pied de page des forums