Add keyboard commands 0-9 to set the step delay. 1 == 100ms, 9 == 900 ms, 0 == 1 second. Reference: /n/sources/patch/applied/life-speedstep Date: Mon Sep 26 03:40:14 CES 2011 Signed-off-by: lyndon@orthanc.ca --- /sys/src/games/life.c Mon Sep 26 03:38:19 2011 +++ /sys/src/games/life.c Mon Sep 26 03:38:07 2011 @@ -30,6 +30,7 @@ int col[NLIFE]; char action[18]; /* index by cell contents to find action */ char *adjust[NADJUST]; +int delay; Point cen; Image *box; @@ -100,9 +101,15 @@ while (ecanmouse()) emouse(); /* throw away mouse events */ - while (ecankbd()) - if ((c = ekbd()) == 'q' || c == 0177) /* watch keyboard ones */ + while (ecankbd()){ + c = ekbd(); + if (c == 'q' || c == 0177) /* watch keyboard ones */ exits(nil); + if (c >= '1' && c <= '9') + delay = (c - '0') * 100; + else if (c == '0') + delay = 1000; + } if (needresize) reshape(); } @@ -110,8 +117,7 @@ void main(int argc, char *argv[]) { - int delay = 1000; - + delay = 1000; setrules(".d.d..b..d.d.d.d.d"); /* regular rules */ ARGBEGIN { case '3':