Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Not really obfuscated, just hard to read because I was trying to shorten it enough so that Netscape would let me use it as a sig file. I wrote it with 5.6.0 outputting in a bash shell, and I'm quite sure it's not terribly portable. You'll have to trim out the red '+'s, and join those lines, I think, to get it to run right.
@a=0..63;g(o($_),a($_)?$_<24?"w":$_>39?"b":0:0)for@a;$w=$b=12;while($w +&&$b) {$z=!$z if!$r;$i=" 01234567\n";print$i,(join"",map{($x,$y)=o($_);($x?" +":$y) .(a($_)?`tput smso`:`tput rmso`).(g(o($_))||" ").`tput rmso`.($x==7?"$ +y\n": "")}@a),$i;$z?&n:&c;g($f,$g,($g==7&&$z)||!($z||$g)?uc&w:g($d,$e));g($d +,$e,0 );t(1)}sub n{print"$_[0]xyxy?\n";($d,$e,$f,$g)=split"",<STDIN>;&v||&n} +sub t{ @t=($f>$d?$d+1:$d-1,$g>$e?$e+1:$e-1);if($s==4&&g(@t)&&lc(g(@t))ne&w +){if( @_){g(@t,0);$z?--$b:--$w;&b}1}else{0}}sub v{$s=($d-$f)**2;(lc(g($d,$e) +)ne&w ||$s!=($e-$g)**2||g($f,$g)||$f>7||$f<0||$g>7||$g<0||(($z?$e-$g:$g-$e)> +0)&&! (g($d,$e)eq uc&w)||!($s==1||t())||($r?$d!=$c||$e!=$h:0))?0:1}sub c{for +(@a){ ($d,$e)=o($_);if(lc(g(o($_)))eq&w){for(@a){($f,$g)=o($_);&t?return:pus +h@q,[ $d,$e,$f,$g]if&v}}}($d,$e,$f,$g)=@{$q[$#q]}}sub w{$z?"w":"b"}sub o{($_[0]%8,int($_[0]/8))}sub a{($_[0]%8+int($_[0]/8))%2}sub g{$n=$_[0]+8*$_[1];defined$_[2]?$j[$n]=$_[2]:$j[$n]}sub b{$d=$c=$f;$e= +$h=$g ;$r=(grep{($f,$g)=o($_);&v&&t()}@a)?1:0}die$w?"win":"lose"."\n"
I was happy for it to come in under 1k (1 byte under)

In reply to I'm bored, let's play a game by Anonymous Monk

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (4)
As of 2024-04-24 01:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found