Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: JAPH attempt using Term::ANSIScreen - redux

by atcroft (Monsignor)
on Jan 28, 2007 at 01:01 UTC ( #596925=note: print w/ replies, xml ) Need Help??


in reply to JAPH attempt using Term::ANSIScreen - redux

I realized that I was doing way too much in the open, so playing around with the encoding mechanism I had gave me the following code (presented here, for your enjoyment).

#!/usr/bin/perl -w use strict; use Term::ANSIScreen; $| = 1; my %config = ( delay => 0.1, width => 75, looptimes => 10 ); my (@characterline); foreach my $i ( 0 .. 8 ) { push @characterline, ' ' x 226; } while ( my $line = <DATA> ) { while ( $line =~ m/(.)(.)(.{2})/g ) { substr( $characterline[ hex($2) ], hex($3), 1, $1 ); } } my $console = Term::ANSIScreen->new; { $console->Cls(); foreach my $i ( 0 .. ( $config{looptimes} - 1 ) ) { foreach my $x ( 0 .. length( $characterline[0] ) ) { $console->Cursor( 1, 1 ); foreach my $y ( 0 .. $#characterline ) { print substr( $characterline[$y] x 2, $x, $config{width} ), "\n"; } select undef, undef, undef, $config{delay}; } } } __DATA__ J002J003J004J005J006h051h052l090l091l092l093h0a2h0a3k0bdk0beJ104 J105h151h152l191l192h1a2h1a3k1bdk1beJ204J205s212s213s214s215s216 t21dt21ea22ea22fa230a231a232o241o242o243t24at24bh251h252e25be25c e25de25er263r265r266r267r268p275p276p278p279p27ae27fe280e281e282 r287r289r28ar28br28cl291l292h2a2h2a3a2aca2ada2aea2afa2b0c2b6c2b7 c2b8k2bdk2bek2c1k2c2e2c7e2c8e2c9e2car2cfr2d1r2d2r2d3r2d4J304J305 u309u30au30du30es312s313t31bt31ct31dt31et31ft320a332a333n336n338 n339n33an33bo33fo340o344o345t348t349t34at34bt34ct34dh351h352h353 h354h355e35ae35be35ee35fr363r364r368r369p375p376p377p37be37ee37f e382e383r387r388r38cr38dl391l392h3a2h3a3h3a4h3a5h3a6a3b0a3b1c3b4 c3b5k3bdk3bek3c0k3c1e3c6e3c7e3cae3cbr3cfr3d0r3d4r3d5J404J405u409 u40au40du40es412s413s414s415s416t41dt41ea42ea42fa430a432a433n436 n437n43bn43co43fo440o444o445t44at44bh451h452h455h456e45ae45be45c e45de45ee45fr463r464p475p476p477p47be47ee47fe480e481e482e483r487 r488l491l492h4a2h4a3h4a6h4a7a4aca4ada4aea4b0a4b1c4b4c4b5k4bdk4be k4bfk4c0k4c1e4c6e4c7e4c8e4c9e4cae4cbr4cfr4d0J501J502J504J505u509 u50au50du50es516s517t51dt51ea52da52ea532a533n536n537n53bn53co53f o540o544o545t54at54bh551h552h555h556e55ae55br563r564p575p576p578 p579p57ae57ee57fr587r588l591l592h5a2h5a3h5a6h5a7a5aba5aca5b0a5b1 c5b4c5b5k5bdk5bek5c0k5c1e5c6e5c7r5cfr5d0J602J603J604u60au60bu60c u60es612s613s614s615s616t61et61ft620a62ea62fa630a632a633n636n637 n63bn63co641o642o643t64bt64ct64dh651h652h655h656e65be65ce65de65e e65fr663r664p675p676e67fe680e681e682e683r687r688l692l693l694h6a2 h6a3h6a6h6a7a6aca6ada6aea6b0a6b1c6b6c6b7c6b8k6bdk6bek6c1k6c2e6c7 e6c8e6c9e6cae6cbr6cfr6d0p775p776

Update 2007-01-27: Removed one configuration and one left-over variable. Placed remaining three into a single hash, and updated code to use hash. Updated loop to prepare @characterline array. Updated loop to use the number of items in @characterline.

Update 2007-01-27: Changed routine loading from DATA to use a regex rather than multiple substr() calls.


Comment on Re: JAPH attempt using Term::ANSIScreen - redux
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://596925]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (12)
As of 2015-07-29 22:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (269 votes), past polls