- #!/usr/bin/ksh93
- # unfinished
- compound c=(
- compound tty=(
- integer max_x
- integer max_y
- )
- compound data=(
- float -a vals
- float min=0
- float max=0
- )
- )
- (( c.tty.max_x=$(tput cols)-2 ))
- (( c.tty.max_y=$(tput lines)-2 ))
- integer i
- integer max_i=${c.tty.max_x}
- for ((i=0 ; i < max_i ; i++ )) ; do
- (( c.data.vals[i]=sin(i/5.) ))
- done
- for i in "${!c.data.vals[@]}" ; do
- (( c.data.min=fmin(c.data.vals[i], c.data.min) ))
- (( c.data.max=fmax(c.data.vals[i], c.data.max) ))
- done
- clear
- for ((i=0 ; i < max_i ; i++ )) ; do
- tput cup $(( int(fmax( (c.tty.max_y/2.)*(fabs(c.data.min)+c.data.vals[i]), 0.0)) )) $i
- printf '.'
- done
- tput cup ${c.tty.max_y} ${c.tty.max_x} ; print
- #print -v c
- # EOF.
simple console ksh93 sinus plotter #001
Posted by Anonymous on Tue 26th Apr 2022 19:56
raw | new post
view followups (newest first): simple console ksh93 sinus plotter #001 by Anonymous
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.