#include "fonction.h" void smartmove(t_move* move, t_move** actions, int E1, Position pos1, Position pos2, Position tresor, char* labData, int size_x, int size_y){ //Joue avec une stratégie pour gagner ! if(astarCompare(pos1,pos2,tresor,labData,size_x,size_y)<1 && E1>=5){ smartRotate(move,E1,pos1,pos2,tresor,labData,size_x,size_y); } if(move->type==8){ Astaromove(move, actions, pos1, tresor, labData, size_x, size_y); } } //NOTE : SI aucun move avantageux trouvé, on change var de facon a faire des recherches sur tout le labyrinthe void smartRotate(t_move* movef, int E1, Position pos1, Position pos2, Position tresor, char* labData, int size_x, int size_y){ //Cherche la rotation la plus avantageuse avec une amplitude de recherche de varX, varY char* labTest; //Labyrinthe temporaire t_move test_move; Position ptest1, ptest2, ptestt; int avance=0,temp=0,i=0,varX=3,varY=3; //var indique la largeur des recherches autour du tresor //Initialisation movef->type=8; movef->value=0; labTest = strdup(labData); //Malloc //Evaluations des lignes for(i=tresor.y-varY; iavance){ //Si la rotation est plus intéressante, on la garde movef->type = move.type; movef->value = move.value; return temp; } else{ return avance; } }