#!/usr/bin/perl -w use strict; $_= q^$ 6{1 }=sub{@ 1=m ap{ 'E' eq$ _?c hr( 32):$_}@0 ;$\ =(' -'x 5).$/ ;{p rin t"@ 1[@ 2]\n" ;pr int "@1 [@3 ]\n "}$ \=q'" ';c hop $\; pri nt"@1 [@4 ]\n "}; @0=('E')x 9;@ 9=( 7)x 3;@ 8=( 011 1)x3;@7 =(2 **8 ,12 05) ;fo r(0..2){$8[$_]*=2**$_;$9[$_]=$9[$_]<<(3*$ _);for(@7){$_=oct}}@9=(@9,@8,@7);for(2..4 ){e val "\@ $_= (${ \(($_-2 )*3 )}. .${ \(( $_- 1)* 3-1)})"}$ 6[1 ]=s ub{ {$==p op; $%= 0}f or( @4,@2 ,@3 ){$ %+= ($= >>$ _)& 1}$%} ;$6 {l} =su b{$ ;=0;f or( 0.. 8){ $0[$_]eq' X'? $;+ =2* *$_ :0} {(g rep{&{$ 6[1 ]}( $_& $;) ==3 }@9)?return'X':0}$;=0;for(0..8){$0[$_]eq' O'?$;+=2**$_:0}(grep&{$6[1]}($_&$;)==3,@9 )?' O': ''};for (1. .9) {do {$; =rand(9 )}until$0 [$; ]eq 'E' ;$0 [$;]=$_%2 ?'X ':' O'; ($.=& {$6 {l} })? las t:0 }$. .=$ .?c hr( 32) .'w ins !': '';$" ='| ';& {$6 {1}};$.?p rin t$. ,$/ :0^ ;s;tic$|[ ];;g;/t ict act oer ule s/;eval

Note: You may want to run it a few times for full effect.

His Royal Cheeziness


In reply to The Ultimate Game by CheeseLord

Title:
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, details, 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, summary, 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.