Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
An old classic, ideal to waste some time with (either playing or deobfuscating ...)

#!/usr/bin/perl use strict; use Term'ReadKey;ReadMode 'cbreak';$,=$/;$/=++$b+$b;$=='8';$b=$= x28;$*=$=x2;@!=(qw(4 _ " a 1 1 0 0 ));$![7]=`clear` ;push(@!,split shift(@!),q 7$=W8W$=8$b eq "j"8W$=8$=W8 $b eq "l"8W$=8W!8($b eq"k"&&$_!~/!/)a#W$=8#$=W8$=W#8W$=#8#!8##a\*8 $=8p$=8$=p 8$=q8q$=8p(#.{59})$=8$=$ 1q8#q(.{60 })$=8#$=$1 pap(.{60})!8$![0]++;"\*$ 1$="8q(.{6 0})!8$![0] ++;"\*$1$="8(t.*)!8$b=(l ength$1)-6 1;substr($ 1,0,$b )."!". substr($1, $b+1).$=4x "gs'"x"c"es'"c"z"gs if'.shift"z"l"just another perl hacker"l 4'SpaceInvaders'.($=x12).' j=left k=fire l=right' _'#'x58_("$*p$*"x11).$=x3_$*.("$*$*q"x11).$=_("p$*$*"x11).$= x3_($=x3).("$*$*q"x11)_1_$b.$=."W$b"_'#'x 587);j(split shift @!,pop@!);a(split shift@!,pop@!);push(@!,split shift@!,pop@! );$_=$a;map{s/\n//g}@!;map{s/v//g}@!;map{s/ //g}@!;&p;sub'j {$_=shift;$a.=m/^1/?("#$b$=$=$b#$,"x12):"#".eval( )."#$,";@_ &&j(@_)}sub'END{ReadMode 'normal' }sub'a{eval"sub'".pop().'{ eval\'s/\'.(shift).\'/\'.(shift).\'/'.pop().';@_&&'.pop().'( @_)}';@_&&a(@_)}sub'p{$b=ReadKey -1;$![1]%3==0&&x(split$=,$! [6]);z(split$=,$![4]);x(split$=,$![5]);c(split$=,$![7]);$![1 ]++;select+(@-,@-,@-,0.05);($![2]=$_)=~s/$=/ /g;/pW|Wq/&&h(' Game over');$_!~/p|q/&&h('You saved our planet. Yeah');print $![3],$![2 ];&p}sub h{print $![ 3],shift," You killed $![0] space invaders ",$,;exit}
  • If you have problems with copy&pasting the code, download it from here
  • Term::ReadKey is required, as I was to lazy to implement its functionality myself
  • There might be some problems with the refresh rate, depending on your hard/software. You could try different values, shouldn't be too hard to find in the code.
  • There are no IFs, WHILEs or FORs - as thedamian once said, control structures are for whimps!
  • In fact, most of the functions used are array manipulating stuff and regexes (and one or two (three, in fact) evals, of course)
I'll post a solution later this week...

UPDATE: Here is the solution.

#!/usr/bin/perl -w just another perl hacker

In reply to Space Invaders by domm

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 all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others surveying the Monastery: (5)
    As of 2017-02-22 03:12 GMT
    Find Nodes?
      Voting Booth?
      Before electricity was invented, what was the Electric Eel called?

      Results (324 votes). Check out past polls.