From a28bd67968b4e933f8775ddfe5d627da4eab9c35 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Thu, 9 Nov 2023 09:17:29 -0800 Subject: [PATCH] Some fixes in 1993/rince It was stated, perhaps even by me but no longer sure of this (it looks like my style) that after the program is terminated the terminal might not be sane and one could do 'stty sane', 'reset' and other things. Instead I have changed the code to just call endwin() and removed that information instead. This way the user should not be burdened by it. The alt code that I had added earlier on also has this fix. The markdown files have not been completely checked but both README.md and design.md have had some fixes applied. The thanks file also points out that Yusuke's fix applies the suggested fix for select(2) found in the README.md. --- 1993/rince/README.md | 19 ++++++++++++------- 1993/rince/design.md | 4 ---- 1993/rince/rince.alt.c | 1 + 1993/rince/rince.c | 1 + thanks-for-fixes.md | 6 +++++- 5 files changed, 19 insertions(+), 12 deletions(-) diff --git a/1993/rince/README.md b/1993/rince/README.md index 6d0863d2b..7c6a867b9 100644 --- a/1993/rince/README.md +++ b/1993/rince/README.md @@ -5,7 +5,7 @@ make all ``` NOTE: there is an alternate version of this program that allows one to slow down -the game. See the Alternate code section below. +the game. See the [Alternate code](#alternate-code) section below. ## To use: @@ -18,7 +18,8 @@ where: `[cabbage]` is a CABBAGE description file (default: `rince.c`) -## Alternate code: slowing down the game + +## Alternate code Some people may want to slow down the game by increasing the value 17 in the lines: @@ -34,7 +35,10 @@ and refresh(),c=select(k,&y,0,0,(v.tv_usec=1<<17,&v))?getch():0; ``` -to another value like 18 or 19. You can do this via the alternate code like: +to another value like 18 or 19 which you can do with the alternate code. + + +### Alternate build: ```sh @@ -43,6 +47,9 @@ make CDEFINE="-DZ=18" clobber alt Replace 18 with whatever number you wish. + +### Alternate use: + Use `rince.alt` as you would `rince` above. @@ -97,6 +104,7 @@ select(k,&y,0,0,(v.tv_usec=1< o.. ... \.. --> 'o' .o. --> '.' ... .\. - - ``` However, the system I devised, in order to keep things small and neat(!), @@ -27,7 +24,6 @@ Hence: .o. ... .\. --> .\o ... ... - ``` This does of course have the odd problem with clashes. What if we want to diff --git a/1993/rince/rince.alt.c b/1993/rince/rince.alt.c index 5c9ce9039..9c94833be 100644 --- a/1993/rince/rince.alt.c +++ b/1993/rince/rince.alt.c @@ -120,4 +120,5 @@ int main(int open, U**exit) { t=(j*I*a(Q--,--Q))); t->y=J[Y][c]; J[Y][c]=t; fgets(t->x,20,C); } + endwin(); } diff --git a/1993/rince/rince.c b/1993/rince/rince.c index fbf443aa6..4afe3460a 100644 --- a/1993/rince/rince.c +++ b/1993/rince/rince.c @@ -120,4 +120,5 @@ int main(int open, U**exit) { t=(j*I*a(Q--,--Q))); t->y=J[Y][c]; J[Y][c]=t; fgets(t->x,20,C); } + endwin(); } diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md index 10c91022c..92bb8c6d9 100644 --- a/thanks-for-fixes.md +++ b/thanks-for-fixes.md @@ -1610,7 +1610,11 @@ also checks for two args. See the README.md files for details. ## [1993/rince](1993/rince/rince.c) ([README.md](1993/rince/README.md])) -Yusuke supplied a patch to get this to work in modern systems. +Yusuke supplied a patch to get this to work in modern systems. This fix also +applies the compatibility issue of `select(2)` described in the README.md file. + +Cody added a call to `endwin()` to help with terminal sanity after the program +ends. Cody provided an alternate version to simplify slowing the game down. This was based on our suggestion that it might be desired to slow down but done in a way