//
// Created by Alban on 03/12/2024.
//
#ifndef PROJET_RESEAUX_TROPHIQUES_EQUIPE_3B_SIMULATION1_H
#define PROJET_RESEAUX_TROPHIQUES_EQUIPE_3B_SIMULATION1_H
#include "affichage.h"
#define BLANC al_map_rgb(255,255,255)
#define NB_VALEUR_SIMU 24
// Définir la longueur maximale de la saisie
#define MAX_INPUT_LENGTH_SIMULATION 9
// Fonction pour convertir une couleur hexadécimale en ALLEGRO_COLOR
ALLEGRO_COLOR hex_to_color(const char* hex);
// Fonction pour lire le contenu d'un fichier JSON
char* lire_fichier(const char* chemin);
// Fonction pour récupérer les informations depuis un fichier JSON
int* recuperer_info_json(const char* fichier_json);
// Fonction pour vérifier si deux couleurs sont égales
int couleurs_egales(ALLEGRO_COLOR c1, ALLEGRO_COLOR c2);
// Fonction pour permettre à l'utilisateur de choisir le graphe
void choisir_graphe(char* fichier_json, char* fichier_png);
int maxPop(espece espece1, int compte);
// Fonction pour gérer la saisie de l'utilisateur
int SaisieSimulation(toutAllegro * toutAllegro1, nom_fichier_extension * nomFichierExtension);
// Fonction pour vérifier la validité d'un tableau
bool tableau_valide(int* tableau, int taille);
// Fonction principale de la simulation
void saisirPopulation(toutAllegro * toutAllegro1, nom_fichier_extension * nomFichierExtension, cJSON * json, Graphe * graphe);
void simulationPopulation(toutAllegro * toutAllegro1, nom_fichier_extension * nomFichierExtension, Graphe * graphe, cJSON* json);
void calculPop(Graphe * graphe, int* compte);
void supprimerEspece(Graphe * graphe, int i);
void draw_smooth_curve(toutAllegro * toutAllegro1, double * serie, int max_y, int data_size, ALLEGRO_COLOR colors);
void ecrire_json(Graphe* graphe, int compte);
#endif //PROJET_RESEAUX_TROPHIQUES_EQUIPE_3B_SIMULATION1_H