From marc.weinmann.lwed at statefarm.com Mon Nov 5 08:45:52 2001 From: marc.weinmann.lwed at statefarm.com (Marc Weinmann) Date: Tue Aug 3 23:56:26 2004 Subject: FW: bloomington-normal.pm Message-ID: Skipped content of type multipart/alternative From pawinan at ilstu.edu Fri Nov 9 16:34:27 2001 From: pawinan at ilstu.edu (Phil Winans) Date: Tue Aug 3 23:56:26 2004 Subject: [bn-perlmongers] cheap oss cds Message-ID: Marc, Here is the site we talked about Wednesday for cheap Linux / BSD / open source software CD distributions: www.cheapbytes.com go to: www.cheapbytes.com -> Enter the store -> CheapBytes CDs under Products Phil --- Bloomington-Normal Perl Mongers User's Group -Send List commands to: majordomo@hfb.pm.org -Send List posts to: bloomington-normal-pm@hfb.pm.org From pawinan at ilstu.edu Mon Nov 12 14:31:59 2001 From: pawinan at ilstu.edu (Phil Winans) Date: Tue Aug 3 23:56:26 2004 Subject: [bn-perlmongers] Checkers Game in under 1k of perl Message-ID: Here is a game of checkers I discovered on perlmonks.org today: http://perlmonks.org/?node_id=124845 It's slow and for UNIX (requires tput/terminfo), but fascinating that it is less than 1k. Here is the code: @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"",;&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:push@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" Phil --- Bloomington-Normal Perl Mongers User's Group -Send List commands to: majordomo@hfb.pm.org -Send List posts to: bloomington-normal-pm@hfb.pm.org