From 0b68fd237e3b89df8ba33cf23971f63939575c08 Mon Sep 17 00:00:00 2001 From: Luxferre Date: Thu, 28 May 2026 09:48:15 +0300 Subject: [PATCH] removed the remaining tput dep from 1dlife --- 1dlife | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/1dlife b/1dlife index 55a98a5..7cf7f92 100755 --- a/1dlife +++ b/1dlife @@ -1,10 +1,14 @@ #!/usr/bin/env bash -# Jon Millen's 1D Game of Life in pure Bash +# Jon Millen's 1D Game of Life in pure Bash (zero dependencies) # Usage: echo 'state' | 1dlife [iterations] # Created by Luxferre in 2026, released into public domain ITERS="$1" -[[ -z "$ITERS" ]] && ITERS=$(($(tput lines) - 1)) +if [[ -z "$ITERS" ]]; then # get the iteration count dynamically + shopt -s checkwinsize # enable checking the terminal size + :|: # trigger the WINCH signal to get the size + ITERS=$((LINES - 1)) # the row count is now in LINES +fi [[ -z "$RENDER_CHAR" ]] && RENDER_CHAR='#' # read and process the state