sirius@8800gtx | Bonjour a tous...
Je dois faire un démineur en C j'ai donc mis en place: distribution aléatoire des mines et compter les mines autour de chaque case. On fera l'affichage après mais là on a des problèmes lors de la compilation et malgrès avoir cherché on ne trouve pas quelles sont ces erreurs...
Pourriez vous m'aider s'il vous plait?
Le début du programme est:
Code :
- #include <stdio.h>
- #include <stdlib.h>
- #include "aleat.h"
- #include "allegro.h"
- #include <time.h>
- //distribution des mines
- int alea(int borninf,int bornsup)
- {
- return((rand())%(bornsup-borninf+1)+borninf);
- }
- void distrib_mines(int tableau, int g, int h)
- {
- int nb_mines;
- int a,b,c,d;
- nb_mines=alea(1,g);
- for(b=0; b=nb_mines;b++)
- {
- c=alea(0,g);
- d=alea(0,h);
- if(tableau[c][d]!=9);
- {
- tableau[c][d]=9;
- }
- else
- {
- b=b-1;
- }
- }
- }
- //mines autour
- mines_autour(int tabelo,int to,int z)
- {
- int e,f;
- for(e=1;e=to;e++)
- {
- for(f=1;f=z;f++)
- {
- if(tabelo[e][f+1]==9)
- {
- tabelo[e][f]=tabelo[e][f]++;
- }
- if(tabelo[e][f-1]==9)
- {
- tabelo[e][f]=tabelo[e][f]++;
- }
- if(tabelo[e+1][f]==9)
- {
- tabelo[e][f]=tabelo[e][f]++;
- }
- if(tabelo[e+1][f+1]==9)
- {
- tabelo[e][f]=tabelo[e][f]++;
- }
- if(tabelo[e+1][f-1]==9)
- {
- tabelo[e][f]=tabelo[e][f]++;
- }
- if(tabelo[e-1][f]==9)
- {
- tabelo[e][f]=tabelo[e][f]++;
- }
- if(tabelo[e-1][f+1]==9)
- {
- tabelo[e][f]=tabelo[e][f]++;
- }
- if(tabelo[e-1][f-1]==9)
- {
- tabelo[e][f]=tabelo[e][f]++;
- }
- }
- }
- }
- void jeu()
- {
- int i,j,v,w;
- int mines[i][j];
- int affiche[v][w];
- distrib_mines(mines,i,j);
- mines_autour(i,j);
- }
- main (char **argv, int argc)
- {
- allegro_init(); //initialisation de la bibliothèque
- if(install_mouse())
- { //initialisation de la souris
- printf("Erreur_souris" );
- return;
- }
- if(install_keyboard())
- { //initialisation du clavier
- printf("Erreur clavier" );
- return;
- }
- if(install_timer())
- { //initialisation des timers
- printf("Erreur sur les timers" );
- return;
- }
- set_color_depth(8); //256 couleurs possibles
- if(set_gfx_mode(GFX_AUTODETEC_WINDOWED, 320, 200, 0, 0))
- {
- printf("Erreur sur le graphisme" );
- return;
- }
- clear(screen); //on efface la fenêtre de résolution
- 320*200
- jeu(); //démarage du jeu
- allegro_exit();
- return;
- }
- END_OF_MAIN(); //pour certaines plates-formes
|
|