Abstraction
06. March 2009
06. March 2009
#!/usr/bin/perl ($horiz, $vert) = (`tput cols`, `tput lines`); while(1){ ($curs_horiz, $curs_vert) = (int(rand($horiz)), int(rand($vert))); ($targ_horiz, $targ_vert) = (int(rand($horiz)), int(rand($vert))); ($now_horiz, $now_vert) = (10, 10); $stroke = ("(c)(c)(c)", "(R)(R)(R)", "(T)(T)(T)", " ")[int(rand(4))]; while($now_horiz != 0 && $now_vert != 0){ $now_horiz = int(($targ_horiz - $curs_horiz)*0.1); $now_vert = int(($targ_vert - $curs_vert)*0.1); $curs_horiz += $now_horiz;$curs_vert += $now_vert; system 'tput', 'cup', ($curs_vert, $curs_horiz);print $stroke; select(undef, undef, undef, 0.15); } }