#include #include #include #include #define MAXMERET 6 #define MINMERET 3 #define KORNYV "MERET" #define FEL 328 #define LE 336 #define BAL 331 #define JOBB 333 #define KILEP 'k' #define UJRA 'u' /******* lehet *******/ typedef int lehet(int m, int *x, int *y); lehet lehetbalra {if (*y=MINMERET&&i<=MAXMERET) aktmeret=i; } if (argc==2) { int i; i=atoi(*++argv); if (i>=MINMERET&&i<=MAXMERET) aktmeret=i; } srand((unsigned)time(&t)); general(aktmeret,matrix,&uresx,&uresy); while (megjelenit(aktmeret,matrix),!vegevan(aktmeret,matrix,&uresx,&uresy)&&c!=KILEP) { printf("Kil‚p: %c\tMozgat s: nyilak\téj t bla: %c",KILEP,UJRA); c=getch(); if (!c) c=256+getch(); switch(c) { case UJRA: general(aktmeret,matrix,&uresx,&uresy); break; case FEL: if (lehetfel(aktmeret,&uresx,&uresy)) feltol(matrix,&uresx,&uresy); break; case LE: if (lehetle(aktmeret,&uresx,&uresy)) letol(matrix,&uresx,&uresy); break; case JOBB: if (lehetjobbra(aktmeret,&uresx,&uresy)) jobbratol(matrix,&uresx,&uresy); break; case BAL: if (lehetbalra(aktmeret,&uresx,&uresy)) balratol(matrix,&uresx,&uresy); break; } } if (c!=KILEP) printf("GRATULµLOK, ™N NYERT!!!"); }