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