Skip to content
Snippets Groups Projects
Commit d85a862c authored by PEREZ-SIERRA ERIC's avatar PEREZ-SIERRA ERIC
Browse files

obtenir_valeur ajouté

parent 57035cfd
Branches
No related merge requests found
......@@ -2,6 +2,7 @@
#define N 5
// Dimensions du tableau N X N
typedef struct{
int i;
int j;
......@@ -9,6 +10,8 @@ typedef struct{
// Utile aussi à déterminer si la cellule fut visitée ou non.
}cellule;
cellule lab[N][N];
int cell_mettre_bit_a1(int n, int i){
return (n | (1<<i)); // bitwise or
}
......@@ -20,7 +23,7 @@ void visite(cellule* c){
// Les indice pour la directions seront les suivants: 1 pour haut, 2 pour droite, 3 pour bas, 4 pour gauche
void avance(cellule* c, int d){
cellule avance(cellule* c, int d){
if(d == 1){
// Vers le haut
if(c->i == 0){
......@@ -48,8 +51,18 @@ void avance(cellule* c, int d){
c->j--;
}
}
return *c;
}
char obtenir_valeur(cellule c){
// Aller vers la cellule dans le labyrinthe et afficher sa valeur
// Afficher pour vérifier
printf("La valeu dans la cellule est: %d\n", (lab[c.i][c.j]).v);
return lab[c.i][c.j].v;
}
int main(){
cellule a;
a.i = 0;
......@@ -66,5 +79,10 @@ int main(){
// Coordonnées de la cellule a après avancer = (1, 0)
visite(&a);
printf("%d\n", a.v);
cellule c;
c.i = 0;
c.j = 0;
voisines(c);
return 0;
}
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment