From ff201b7a762bebbad450f7b87b5af40cbd611905 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Sun, 10 Dec 2023 12:10:14 -0800 Subject: [PATCH] Improve 2000/thadgavin alt code Because of the Makefile improvements I made not too long ago the code does not need #ifndef..#endif to set the values to sleep. --- 2000/thadgavin/README.md | 22 ++++++++-------------- 2000/thadgavin/thadgavin.alt.c | 6 ------ 2 files changed, 8 insertions(+), 20 deletions(-) diff --git a/2000/thadgavin/README.md b/2000/thadgavin/README.md index 748218453..512c36f5c 100644 --- a/2000/thadgavin/README.md +++ b/2000/thadgavin/README.md @@ -2,7 +2,7 @@ If you don't have curses or SDL1 installed both modes will fail to compile. In that case see the [FAQ 3.8 - How do I compile an IOCCC winner that requires SDL1 -or SDL2?](/faq.md#faq_38) and [FAQ 3.9 - How do I compile an IOCCC winner that +or SDL2?](/faq.md#SDL) and [FAQ 3.9 - How do I compile an IOCCC winner that requires (n)curses?](/faq.md#faq3_9) for more information. @@ -35,18 +35,12 @@ have to kill it yourself. You might also care to reconfigure the speed at which the programs run. The code calls `usleep(3)` with two default values, one for SDL and one for curses. The -curses and SDL macros are defined respectively in the Makefile: +curses and SDL macros are defined in the Makefile in a way that makes it easy to +redefine the values: `SLEEP` is how long the program sleeps (in microseconds) +between output with curses and `SDL_SLEEP` is how long it sleeps (also in +microseconds) for the SDL version. -```make -SLEEP= 30 -SDL_SLEEP= 150000 -CDEFINE= -DZ=${SLEEP} -DZS=${SDL_SLEEP} -``` - -which corresponds to how long the program sleeps (in microseconds) between -output. In the code if either is undefined (`#ifndef..#endif`) they will be set -to the defaults as above so that you don't have to specify both just to -configure one. To change the SDL one to something like `15000` you can do: +To change the SDL one to something like `15000` you can do: ```sh make SDL_SLEEP=15000 clobber alt @@ -61,8 +55,8 @@ make SLEEP=40 clobber alt Then use the program(s) in the same way. The different macros is because the curses version is already much slower and so -it's better to not tie the two values together. You may of course combine them -in one command. +it's better to not tie the two values together. You may of course redefine both +in the same command. ## Original code: diff --git a/2000/thadgavin/thadgavin.alt.c b/2000/thadgavin/thadgavin.alt.c index ff6db2c95..da405cee7 100644 --- a/2000/thadgavin/thadgavin.alt.c +++ b/2000/thadgavin/thadgavin.alt.c @@ -1,9 +1,3 @@ -#ifndef Z -#define Z 30 -#endif -#ifndef ZS -#define ZS 150000 -#endif int X=320 ,Y=200, n=0,m, x,y, j=1024;