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 83953a7730086d3165fb71cdb48596e93647dd63..512cbc07382a89e968fa0b384f88fd2f90936f18 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 65f18f155cf08a52bbfafe3aa1e19b44ab7bceca..0000000000000000000000000000000000000000 --- 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 deffca1532aaaecc4667a94e10fbd8b6eda02fa2..0000000000000000000000000000000000000000 --- 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