]> git.armaanb.net Git - pong.git/commitdiff
Clean up main
authorArmaan Bhojwani <me@armaanb.net>
Sun, 16 May 2021 13:25:14 +0000 (09:25 -0400)
committerArmaan Bhojwani <me@armaanb.net>
Sun, 16 May 2021 13:25:14 +0000 (09:25 -0400)
pong.c

diff --git a/pong.c b/pong.c
index c15860731b9cabf998e285cb39223741450781d2..e03aa17f75123ef4409f1fabe2ea3e8f375e378b 100644 (file)
--- a/pong.c
+++ b/pong.c
@@ -41,7 +41,7 @@ msleep(void)
 {
        struct timeval timeout;
        timeout.tv_usec = 10000;
-       select(NULL, NULL, NULL, NULL, &timeout); // Sleep 100 ms
+       select(0, NULL, NULL, NULL, &timeout); // Sleep 100 ms
 }
 
 int
@@ -152,7 +152,7 @@ main(void) {
                        /* Find the distance that the ball hits from the center of the padel and
                                 accordingly adjust ball path */
                        int poff = (x <= 1) ? aoff : boff;
-                       double fromc = (fabs(poff + 0.5 * pad_h - y) / 2);
+                       double fromc = fabs(poff + 0.5 * pad_h - y) / 3;
                        slope_x /= (abs(slope_x) > 25) ? 2 : fromc;
                        slope_x = (slope_x < 2) ? 2 : slope_x;