From 515105864def1f5fcbae10f9f51e9e71baf8e1fa Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Thu, 7 Dec 2023 10:30:09 -0800 Subject: [PATCH] Improve redefining sleep time in 2000/thadgavin Now one can do instead make SLEEP=555 SDL_SLEEP=555 alt where SLEEP is the variable for the curses version and SDL_SLEEP is for the SDL version. One need not specify both if they do not want to redefine one or the other and of course one doesn't have to specify a sleep time at all either. --- 2000/thadgavin/Makefile | 6 +++++- 2000/thadgavin/README.md | 13 ++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/2000/thadgavin/Makefile b/2000/thadgavin/Makefile index 8ed8c5916..551244ba6 100644 --- a/2000/thadgavin/Makefile +++ b/2000/thadgavin/Makefile @@ -56,9 +56,13 @@ CSTD= -std=gnu99 # ARCH= +# variables for redefining the time to sleep, primarily for alt code +# +SLEEP= 30 +SDL_SLEEP= 150000 # Defines that are needed to compile # -CDEFINE= -DZ=30 -DZS=150000 +CDEFINE= -DZ=${SLEEP} -DZS=${SDL_SLEEP} # Include files that are needed to compile # diff --git a/2000/thadgavin/README.md b/2000/thadgavin/README.md index c27eaf4ed..748218453 100644 --- a/2000/thadgavin/README.md +++ b/2000/thadgavin/README.md @@ -37,8 +37,10 @@ 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: -``` --DZ=30 -DZS=150000 +```make +SLEEP= 30 +SDL_SLEEP= 150000 +CDEFINE= -DZ=${SLEEP} -DZS=${SDL_SLEEP} ``` which corresponds to how long the program sleeps (in microseconds) between @@ -47,19 +49,20 @@ 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: ```sh -make CDEFINE="-DZS=15000" clobber alt +make SDL_SLEEP=15000 clobber alt ``` and to change the curses one to `40`: ```sh -make CDEFINE="-DZ=40" clobber alt +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. +it's better to not tie the two values together. You may of course combine them +in one command. ## Original code: