EDIT: golfed it down a bit, also fixed some literal edge cases (the sprites where behaving strangely when they hit the edges of the screen).sub'r{$==rand pop}$|=print"\e[2J";r$l=`tput lines`-2,s/^$/"\e[$=;".r($ +c =`tput cols`-2).f.' Oo*... '=~s!\S\K!\e[B\b !gr/e/s/\d++\B/($a=$&-1)+( +$ ==!$a+r$a%$c?3:2)/e/s/(?<=(.)...B.)./$1/g/s/f\K./chr 32>>$=/e/s/\d+/($ +& ||$l)-1/e,select$,,$,,$,,.009*print$&?$_:"\e[f"."\e[K\n"x6while*_=r.r+ +9
The number at the beginning of the last line determines the speed (smaller = faster). The number at the end of the last line is the maximum number of sprites that can be on screen simultaneously.sub'v{$==!$-+rand pop}[s/\d+/$|--?($-=$&-1)+v$-%$c?3:2:$&-print||`stty + size`- print$&?"\e[?25l\e[2J":y!Oo*.! !r/ge?s/(?<=f|(.))...B.\K./$1||chr 32>> +$=/ge.. 4E4:s/|/o*... //s//\e[B\b /g/s//\e[1;${\v$c=`tput cols`-2}fO/]while*_= +_.v-42#
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Fireworks
by ambrus (Abbot) on Aug 24, 2015 at 19:29 UTC | |
by Grimy (Pilgrim) on Sep 07, 2015 at 11:56 UTC | |
|
Re: Fireworks
by choroba (Cardinal) on Sep 07, 2015 at 15:15 UTC | |
by Grimy (Pilgrim) on Sep 08, 2015 at 07:30 UTC | |
|
Re: Fireworks
by davido (Cardinal) on Aug 25, 2015 at 05:11 UTC |