[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [shell-script] Script Boas Festas
From: |
Alain M. |
Subject: |
Re: [shell-script] Script Boas Festas |
Date: |
Tue, 11 Dec 2007 17:57:17 -0200 |
User-agent: |
Thunderbird 2.0.0.6 (X11/20070728) |
Só qu =e na versão antiga tinha cores...
cá estão elas de volta :)
#!/bin/bash
# Versão 2.0
trap "tput reset; exit" 2
clear
tput civis
lin=2
col=$(($(tput cols) / 2))
c=$((col-1))
tput setaf 2; tput bold
# Montando a Árvore
for ((i=1; i<20; i+=2))
{
tput cup $lin $col
for ((j=1; j<=i; j++))
{
echo -n \*
}
let lin++
let col--
}
tput sgr0; tput setaf 3
for ((i=1; i<=2; i++))
{
tput cup $((lin++)) $c
echo 'mWm'
}
tput setaf 1; tput bold
tput cup $lin $((c - 4)); echo BOAS FESTAS
let c++
k=1
# Pendurando as bolas (da árvore, claro!)
while true; do
for ((i=1; i<=25; i++))
{
# Apagando a bola que foi ligada há 25 rodadas atras
[ $k -gt 1 ] && {
tput setaf 2; tput bold
tput cup ${linha[$[k-1]$i]} ${coluna[$[k-1]$i]}; echo \*
tput setaf 1; tput bold
# Mantenha limpo o vetor
unset linha[$[k-1]$i]; unset coluna[$[k-1]$i]
}
li=$((RANDOM % 9 + 3))
ini=$((c-li+2))
fim=$((c+li+2))
co=$((RANDOM % (li-2) * 2 + 1 + ini))
color=$((RANDOM % 10))
tput setaf $color
tput cup $li $co
echo o
linha[$k$i]=$li
coluna[$k$i]=$co
sleep 0.2
}
let k++
done
- Script Boas Festas, Reinaldo Carvalho, 2007/12/10
- Re: [shell-script] Script Boas Festas, Fábio Gomes, 2007/12/11
- [shell-script] Cálculo de Fatorial, Alan Diones, 2007/12/12
- Re: [shell-script] Cálculo de Fatorial, Flavio Junior, 2007/12/12
- Re: [shell-script] Cálculo de Fatorial, Tiago Barcellos Peczenyj, 2007/12/12
- Re: [shell-script] Cálculo de Fatorial, Julio C. Neves, 2007/12/12
- Re: [shell-script] Cálculo de Fatorial, Alan Diones, 2007/12/13
- Re: [shell-script] Cálculo de Fatorial, Julio C. Neves, 2007/12/13