removed the remaining tput dep from 1dlife
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user