Correction of an endwin forgotten + little error in arguments handling
This commit is contained in:
parent
a0171f8a7c
commit
6522e8219d
13
main.c
13
main.c
@ -7,8 +7,6 @@
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
//TODO !!!!
|
||||
// Inverser X et Y cf. Le retour
|
||||
int kbhit(void)
|
||||
{
|
||||
struct termios oldt, newt;
|
||||
@ -44,7 +42,7 @@ int main(int argc, char **argv)
|
||||
// o (=old), n(=new) for switching between the two matrices X*Y
|
||||
//Nbre_iterations = number of iterations
|
||||
int **m[2];
|
||||
int i, j, k;
|
||||
int i, j;
|
||||
int count = 0, density = 50, o = 0, n, Y, X, nbre_iterations=0;
|
||||
int carac = 64; //@
|
||||
|
||||
@ -55,10 +53,10 @@ int main(int argc, char **argv)
|
||||
X -= 1;
|
||||
|
||||
// If there's not enough args, give a short How-To
|
||||
if(argc < 1)
|
||||
if(argc < 2)
|
||||
{
|
||||
printw("Usage : %s [density in %] \n", argv[0]);
|
||||
refresh();
|
||||
endwin();
|
||||
printf("Usage : %s [density in %] \n", argv[0]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -92,9 +90,10 @@ int main(int argc, char **argv)
|
||||
for(j = 0; j < Y; j++)
|
||||
{
|
||||
// We put 1 if the number token is > density
|
||||
m[0][i][j] = (rand() % 100 > density) ? 1 : 0;
|
||||
m[0][i][j] = ((rand() % 100) > density) ? 1 : 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Clear the screen and print the matrice 0
|
||||
clear();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user