#include <stdio.h>
#include <unistd.h>
#include <sys/time.h>
+#include <sys/select.h>
#include <time.h>
#include <math.h>
return pow(-1, rand());
}
+void
+msleep(void)
+{
+ struct timeval timeout;
+ timeout.tv_usec = 10000;
+ select(NULL, NULL, NULL, NULL, &timeout); // Sleep 100 ms
+}
+
int
main(void) {
srand((unsigned int)time(NULL));
} else if (key == 'q') {
die(0);
}
+ msleep();
}
}
mvprintw(y, x, " ");
y = (y == max_y) ? max_y - 1 : 1;
}
+ msleep();
}
}