From d19bc68cb915260d05199b07d6d732f65d0d8887 Mon Sep 17 00:00:00 2001 From: belkhiritaha <belkhiri.taha53@gmail.com> Date: Thu, 30 Jun 2022 11:25:52 +0200 Subject: [PATCH] commit avant de merge avec qlearn4 --- .../jeu_appren_par_renfo/src/ennemy.c | 2 +- .../jeu_appren_par_renfo/src/qlearn.c | 99 ------------------- .../jeu_appren_par_renfo/src/qlearn.h | 32 ------ 3 files changed, 1 insertion(+), 132 deletions(-) delete mode 100644 travail_de_groupe/jeu_appren_par_renfo/src/qlearn.c delete mode 100644 travail_de_groupe/jeu_appren_par_renfo/src/qlearn.h diff --git a/travail_de_groupe/jeu_appren_par_renfo/src/ennemy.c b/travail_de_groupe/jeu_appren_par_renfo/src/ennemy.c index 83953a7..512cbc0 100644 --- a/travail_de_groupe/jeu_appren_par_renfo/src/ennemy.c +++ b/travail_de_groupe/jeu_appren_par_renfo/src/ennemy.c @@ -11,5 +11,5 @@ void initEnnemy() void manageEnnemy() { - + } \ No newline at end of file diff --git a/travail_de_groupe/jeu_appren_par_renfo/src/qlearn.c b/travail_de_groupe/jeu_appren_par_renfo/src/qlearn.c deleted file mode 100644 index 65f18f1..0000000 --- a/travail_de_groupe/jeu_appren_par_renfo/src/qlearn.c +++ /dev/null @@ -1,99 +0,0 @@ -#include "qlearn.h" - -void moveAgent(agent_t * agent, int choice){ - switch (choice) - { - case BACK: - agent->x += 1*agent->speed; //Avancer - break; - - case FOWARD: - agent->x -= 1*agent->speed; // reculer - break; - - case UP: - agent->y += 1*agent->speed; - break; - - case DOWN: - agent->y -= 1*agent->speed; - break; - case WAIT: - break; - } -} - -float ***** allocateAndInitiateQ(){ - int i,j,k,l,m; - - float ***** q = malloc(sizeof(float ****) * NUMBER_ZONE_RECEIVER); /// alloc player zone - if (q==NULL) - { - printf("problème d'allocation \n"); - exit(1); - } - - for(i = 0; i < NUMBER_ZONE_RECEIVER; i++){ - q[i] = malloc(sizeof(float ***) * NUMBER_ZONE_SHOOTER ); // alloc shooter zone - if (q[i]==NULL) - { - printf("problème d'allocation \n"); - exit(1); - } - - for(j = 0; j< NUMBER_ZONE_SHOOTER; j++){ - q[i][j] = malloc(sizeof(float **) * 3 ); // alloc angle hauteur - - if (q[i][j]==NULL) - { - printf("problème d'allocation \n"); - exit(1); - } - - for(k = 0; k <3 ; k++){ - q[i][j][k] = malloc(sizeof(float *) * 5 ); // alloc angle plat - - if (q[i][j][k]==NULL) - { - printf("problème d'allocation \n"); - exit(1); - } - for(l = 0; l<5 ; l++){ - q[i][j][k][l] = malloc(sizeof(float ) * 5); //alloc action - - if (q[i][j][k][l]==NULL) - { - printf("problème d'allocation \n"); - exit(1); - } - for (m=0;m <5;m++){ - q[i][j][k][l][m]=0; - } - - } - } - } - } - return q; -} - - -void writeQ(float *****Q){ - int i, j, k, l, m ; - FILE * fp = fopen("q.txt", "w+"); - for(i = 0; i < NUMBER_ZONE_RECEIVER; i++){ - for(j = 0; j < NUMBER_ZONE_SHOOTER; j++){ - for(k = 0; k < 3; k++){ - for(l= 0; l < 5; l++){ - for(m= 0; m <5; m++){ - fprintf(fp, "%f ", Q[i][j][k][l][m]); - } - } - } - fprintf(fp, "\n"); - } - fprintf(fp, "\n"); - } - fflush(fp); - fclose(fp); -} \ No newline at end of file diff --git a/travail_de_groupe/jeu_appren_par_renfo/src/qlearn.h b/travail_de_groupe/jeu_appren_par_renfo/src/qlearn.h deleted file mode 100644 index deffca1..0000000 --- a/travail_de_groupe/jeu_appren_par_renfo/src/qlearn.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef Q_LEARN -#define Q_LEARN - -#include <stdio.h> -#include <stdlib.h> -#include <time.h> -//#include "ball.h" -#include "math.h" -#include "map.h" - -#define NUMBER_ZONE_SHOOTER 4 -#define NUMBER_ZONE_RECEIVER 4 - -#define FOWARD 0//<-- -#define BACK 1 //--> -#define UP 2 -#define DOWN 3 -#define WAIT 4 - -typedef struct agent { - int x; - int y; - int heigth; - int weight; - int speed; -} agent_t; - - -void moveAgent(agent_t * agent, int choice); -float ***** allocateAndInitiateQ(); -void writeQ(float *****Q); -#endif \ No newline at end of file -- GitLab