43 lines
800 B
C
43 lines
800 B
C
/* Création du plateau de jeu avec les pastilles et le serpent
|
|
|
|
written by Yann KERAUDREN and Titouan LERICHE*/
|
|
|
|
|
|
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
#include <time.h>
|
|
#define LIGNES 40
|
|
#define COLONNES 60
|
|
#define NBR_POMME 5
|
|
|
|
int main(void) {
|
|
|
|
int tableau[LIGNES][COLONNES] = {0}, ligne_pomme, colonne_pomme, indice, indice2, compteur = 0 ;
|
|
|
|
srand(time(NULL));
|
|
|
|
for ( indice = 0; indice < NBR_POMME; indice++) {
|
|
|
|
|
|
ligne_pomme = rand() % 60;
|
|
colonne_pomme = rand() % 60;
|
|
|
|
compteur += 1;
|
|
|
|
tableau[ligne_pomme][colonne_pomme] = 2;
|
|
|
|
}
|
|
|
|
for ( indice = 0; indice < LIGNES; indice++) {
|
|
|
|
for ( indice2 = 0; indice2 < COLONNES; indice2++) {
|
|
|
|
printf("%d", tableau[indice][indice2]);
|
|
|
|
}
|
|
}
|
|
printf("\n%d", compteur);
|
|
|
|
return EXIT_SUCCESS;
|
|
}
|