Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

Since eyepopslikeamosquito laid out a breif history of the JAPH, I figured I might as well add one of the few that I ever wrote. I'm not much into obfus or code in sigs or what not, but I did have an idea for a JAPH after watching The Matrix a couple times, and up until then I hadn't seen anyone use the entire screen and rand() to make the right string pop up.

I did have a obfuscated version of this somewhere, but I can't find it. Just remove most of the whitespace and shorten all the variable names.

Update: fixed eyepopslikeamosquito (twice) :(

#!/usr/bin/perl -w use strict; use Curses; my @LETTERS = ( 'A' .. 'Z', 'a' .. 'z', ',', ' ' ); $SIG{TERM} = sub { exit }; my $STRING = 'Just Another Perl Hacker,'; my $LENGTH = length $STRING; initscr; my $ROW = ( LINES() % 2 ? LINES() - 1 : LINES() ) / 2; my $COLUMN = ( COLS() % 2 ? COLS() - 1 : COLS() ) / 2 - ( $LENGTH % 2 ? $LENGTH - 1 : $LENGTH ) / 2; my $END_COL = $COLUMN + $LENGTH - 1; my @array; my $count = 0; my $x = random( LINES ); my $y = random( COLS ); my $letter = sub { $LETTERS[ int( rand( @LETTERS ) ) ] }; while( 1 ) { my $x = &$x; my $y = &$y; my $letter = &$letter; next if( $x == $ROW and $array[$y] ); if( $x == $ROW and $y >= $COLUMN and $y <= $END_COL and substr( $STRING, $y - $COLUMN, 1 ) eq $letter ) { $array[$y]++; $count++; } put_letter( $letter, $x, $y ); if( $count == $LENGTH ) { @LETTERS = ' '; } } sub random { my $range = shift; sub { int ( rand ( $range ) ) } } sub put_letter { my ($letter, $x, $y) = @_; addch( $x, $y, $letter ); refresh; }
brian d foy <>

In reply to A curses-based JAPH by brian_d_foy

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others imbibing at the Monastery: (8)
    As of 2019-07-22 21:05 GMT
    Find Nodes?
      Voting Booth?
      If you were the first to set foot on the Moon, what would be your epigram?

      Results (21 votes). Check out past polls.