From d2f02c59908b5cd685c1489977af188baf93905b Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Wed, 10 Jan 2024 09:28:33 -0800 Subject: [PATCH] Fix alt build of 1995/cdua The Makefile was missing a SLEEP variable to simplify reconfiguring the usleep(3) (for alt code). Reword the alt code suggestion as well in the README.md. --- 1995/cdua/Makefile | 5 ++++- 1995/cdua/README.md | 20 ++++++++++---------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/1995/cdua/Makefile b/1995/cdua/Makefile index 4e91c6959..e246686e4 100644 --- a/1995/cdua/Makefile +++ b/1995/cdua/Makefile @@ -56,9 +56,12 @@ CSTD= -std=gnu90 # ARCH= +# Variable to simplify reconfiguring sleep time for alt code +# +SLEEP=3000 # Defines that are needed to compile # -CDEFINE= -DZ=3000 +CDEFINE= -DZ=${SLEEP} # Include files that are needed to compile # diff --git a/1995/cdua/README.md b/1995/cdua/README.md index 155cf4f1d..c4591d10a 100644 --- a/1995/cdua/README.md +++ b/1995/cdua/README.md @@ -1,17 +1,18 @@ ## To build: -We recommend that you try this alternate version first. For reasons why this is -see the [original code](#original-code) section below. +We recommend that you try the alternate version first so you can see what this +entry looked like back in 1995 (with a configurable speed). See the [original +code](#original-code) section below for the original entry. ```sh make alt ``` -This alternate version uses `usleep(3)` with `Z` (defined in the Makefile, +The alternate version uses `usleep(3)` with `SLEEP` (defined in the Makefile, default `3000`) microseconds to make it easier to see the maze being solved in -real time. You can redefine `Z` to reconfigure it in case it's going too slow, -too fast :-) or you're doing some strange experiment like making it 100000 -(which is actually fun :-) ). +real time. You can redefine `SLEEP` at compile time to reconfigure it in case +it's going too slow, too fast :-) or you're doing some strange experiment like +making it 100000 (which is actually fun :-) ). ### Bugs and (Mis)features: @@ -34,10 +35,9 @@ For more detailed information see [1995 cdua in bugs.md](/bugs.md#1995-cdua). ### Try: -To use 1500 for `Z` do: ```sh -make CFLAGS="-DZ=1500" clobber alt +make SLEEP=1500 clobber alt ./cdua.alt # press enter and watch it go much faster! ``` @@ -45,12 +45,12 @@ make CFLAGS="-DZ=1500" clobber alt You might also like to try: ```sh -make CFLAGS="-DZ=65000" clobber alt +make SLEEP=65000 clobber alt ./cdua.alt # press enter and watch it go much slower! ``` -Do you see anything strange in this version when `Z` is a high value like +Do you see anything strange in this version when `SLEEP` is a high value like `65000`? What happens if you use `100000`? Is this strange output still there? Why?