maj
This commit is contained in:
38
snake/search_tete.c
Normal file
38
snake/search_tete.c
Normal file
@@ -0,0 +1,38 @@
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "plateau_init.h"
|
||||
|
||||
|
||||
|
||||
|
||||
int* search_tete(int* tete, int** p) {
|
||||
|
||||
|
||||
int i, j;
|
||||
|
||||
|
||||
|
||||
|
||||
/* recherche de la tête et la queue dans le tableau */
|
||||
|
||||
for ( i = 0; i < LIGNES; i++) {
|
||||
|
||||
for ( j = 0; j < COLONNES; j++) {
|
||||
|
||||
if ( p[i][j] == -1) {
|
||||
|
||||
tete[0] = i;
|
||||
tete[1] = j;
|
||||
|
||||
p[i][j] = 1;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return tete;
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user