removed the remaining tput dep from 1dlife

This commit is contained in:
Luxferre
2026-05-28 09:48:15 +03:00
parent c82f49d180
commit 0b68fd237e
+6 -2
View File
@@ -1,10 +1,14 @@
#!/usr/bin/env bash #!/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] # Usage: echo 'state' | 1dlife [iterations]
# Created by Luxferre in 2026, released into public domain # Created by Luxferre in 2026, released into public domain
ITERS="$1" 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='#' [[ -z "$RENDER_CHAR" ]] && RENDER_CHAR='#'
# read and process the state # read and process the state