From 34d0af04ff66785d75342a03c0240c26d10bcb12 Mon Sep 17 00:00:00 2001 From: belkhiritaha <belkhiri.taha53@gmail.com> Date: Wed, 22 Jun 2022 17:50:18 +0200 Subject: [PATCH] transfert markov --- travail_de_groupe/chef_oeuvre/markov.txt | 9 +++++---- travail_de_groupe/chef_oeuvre/src/fire.c | 3 +++ travail_de_groupe/chef_oeuvre/src/fire.h | 3 ++- travail_de_groupe/chef_oeuvre/src/main.c | 4 ++++ travail_de_groupe/chef_oeuvre/src/render.c | 4 ++-- 5 files changed, 16 insertions(+), 7 deletions(-) diff --git a/travail_de_groupe/chef_oeuvre/markov.txt b/travail_de_groupe/chef_oeuvre/markov.txt index dd33806..c4cf894 100644 --- a/travail_de_groupe/chef_oeuvre/markov.txt +++ b/travail_de_groupe/chef_oeuvre/markov.txt @@ -1,4 +1,5 @@ -1 0 0 0 -0 1 0 0 -0 0 1 0 -0 0 0 1 \ No newline at end of file +1 0 0 0 0 +0 1 0 0 0 +0 0 1 0 0 +0 0 0 1 0 +0 0 0 0 1 \ No newline at end of file diff --git a/travail_de_groupe/chef_oeuvre/src/fire.c b/travail_de_groupe/chef_oeuvre/src/fire.c index 8d30ea4..9794417 100644 --- a/travail_de_groupe/chef_oeuvre/src/fire.c +++ b/travail_de_groupe/chef_oeuvre/src/fire.c @@ -185,6 +185,9 @@ void nextFire(listchainfire_t listFire){ else if ((pMedium<=probability)&&(probability<pStrong)){(listTemporary->fire).state=STRONG;} else {(listTemporary->fire).state=SPREAD;} + printf("%d %d\n", probability, state); + printf("%d %d %d %d\n", pDead, pSparkle, pMedium, pStrong); + listTemporary=listTemporary->next; } } \ No newline at end of file diff --git a/travail_de_groupe/chef_oeuvre/src/fire.h b/travail_de_groupe/chef_oeuvre/src/fire.h index 510c4b2..975fb32 100644 --- a/travail_de_groupe/chef_oeuvre/src/fire.h +++ b/travail_de_groupe/chef_oeuvre/src/fire.h @@ -6,7 +6,7 @@ #include <time.h> #include <stdio.h> -#define SIZEMARKOV 4 +#define SIZEMARKOV 5 #define DEAD 0 #define SPARKLE 1 #define MEDIUM 2 @@ -49,4 +49,5 @@ void readFapFromFile(char * filename); void nextFire(listchainfire_t ); + #endif \ No newline at end of file diff --git a/travail_de_groupe/chef_oeuvre/src/main.c b/travail_de_groupe/chef_oeuvre/src/main.c index b6868c9..2ce91a5 100644 --- a/travail_de_groupe/chef_oeuvre/src/main.c +++ b/travail_de_groupe/chef_oeuvre/src/main.c @@ -8,7 +8,11 @@ int main(){ running = 1; gameState = MENU; readMapFromFile("map.txt"); + readFapFromFile("markov.txt"); fireList = startFire(fireList,10,MAPSIZE); travelFire(fireList); + nextFire(fireList); + nextFire(fireList); + nextFire(fireList); mainLoop(); } \ No newline at end of file diff --git a/travail_de_groupe/chef_oeuvre/src/render.c b/travail_de_groupe/chef_oeuvre/src/render.c index 6963c38..87092b0 100644 --- a/travail_de_groupe/chef_oeuvre/src/render.c +++ b/travail_de_groupe/chef_oeuvre/src/render.c @@ -167,8 +167,8 @@ void drawFire(){ srcRect.x = srcRect.w * (SDL_GetTicks()/200 % 8); srcRect.y= 0; while (cour != NULL){ - rect.h = CELLSIZE; - rect.w = CELLSIZE; + rect.h = CELLSIZE * (cour->fire).state; + rect.w = CELLSIZE * (cour->fire).state; rect.x = (cour->fire).x * CELLSIZE + (screenDimension.w - (MAPSIZE * CELLSIZE)) / 2; rect.y = (cour->fire).y * CELLSIZE; SDL_RenderCopy(renderer, fireTexture, &srcRect, &rect); -- GitLab