Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Place your bets

by olus (Curate)
on Sep 26, 2008 at 15:18 UTC ( #713890=obfuscated: print w/replies, xml ) Need Help??

For use when bored or the bamboo sways.

  • 1 to 5 and enter to select cards
  • 1 to 5 and enter to unselect cards
  • d to refresh hand after selecting cards
  • d for a new hand
  • q to quit

Unfortunately you'll have to hit the 'download' link to see the art, and it is not guaranteed to work on all terminals. Nothing hidden, it's just pure char arrangement.

@n =(2,3,4,5, 6, 7, 8, 9, 10 ,'J','Q', 'K', 'A');$C =50; $R =''; $e= 0;@c = map{ "\e[31m".$_. " h"} @n; @p = map{ "\e[32m".$_." c"}@n;@o=map{"\e[31m". $_." d"}@n;@e=map {"\e[32m".$_." s"} @n;@D;(%p,@H,@h);%seen;sub cls{print "\e[1J\e[H";}d();$/=\1;$i;while( $i= <STDIN> ) {last if($i eq 'q');if(($i>=1)&&($i<=5)) {$h[$i-1] =( $h [ $i -1] == 0) ?1:0;p(); }if($i eq 'd'){ if ( $e ){ d () if($C>0);$e= +0;} else{$e=1;f();}}}sub b{my @d= (@c,@p,@o,@ +e);@D= ();while(@d){push@D,splice (@d, rand (@d), 1);}@H= +();push@H , shift@D for 0..4 ; } sub p { cls( ); print "\n\t\t\tCr +edit:$C\n"; for(0..4) { if($h[$_] == 1){print " H ";}else{print " +";}}print"\n" ; print" ".$H[$_]." " for 0..4; print "\e[0m\n\n\t\t\t$R\n\n\n"; i +f( $e==0){print "Cards to hold ([d]eal):";} else{if($C>0){print"[d]eal again or [q]uit +?:";}else{print "No more credits. You must [q]uit:";} }}sub f(){ for(0..4){if($h[$_]== +0){$H[$_]=shift @D;}} P(); p();}sub d{ %p= ('p' => 0 ,'t'=>0,'k'=>0,'f'=>0,'s' +=>0,);@h=(0,0 ,0,0,0); $R=''; $e= 0; $C-- ; b() ;p() ; } sub P{ @v = + map{ $_=~ /m(.*) /; $1}@H;for( 0.. $#v){ if($v[$_]eq'J') {$ +v[$_]= 11 ;}elsif($v[$_]eq'Q') {$v [$_]= 12;}elsif($v[$_] +eq'K'){ $v[$_] = 13 ;} elsif($v[ $_]eq'A'){$v[ +$_]= 14;}}@v= sort@v;if (($v[4]-$v +[ 0])==4){for(1 ..4){ if($v[$_] ==$v[$_-1]+1 ){ $p{ 's'}=1;}else{$p{'s' }=0;last;}}}%seen=();map{ $seen{$_}++} @v; foreach$k(keys %seen){if($seen{$k}==2){$p{'p'}++;}if($seen {$k}==3){$p{'t'}=1;}if($seen{$k}==4){$p{'k'}=1;}}if($p{' +t'} &&$p{'p'}) {$p{'f'}=1;}if($p{'s'}){$R='Sequence!';$C+=6;}elsif( +$p{'f'} ){$R='Fullhouse!'; $C+=4; } elsif( $p{'k'} ){ $R= 'Poker!'; $C += 10; +} elsif ($p{'t'} ){$R='trio';$C+=2;}elsif($p{'p'}){$R="$p{'p'}pair"; $C++;}@h =(0,0,0, +0,0);}print"\n";

Have fun.

Replies are listed 'Best First'.
Re: Place your bets
by sth (Priest) on Oct 15, 2008 at 17:45 UTC

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: obfuscated [id://713890]
Approved by moritz
[1nickt]: I have been an apostate in the Apple orchard for almost 15 years. But Dells are still high quality it seems, unlike Macs these days.
[1nickt]: And you can still configure the system at will, on the "Small Business" site.
[Corion]: 1nickt: I bought a 2015 XPS 13, which is a very nice and shiney (and somewhat overpriced) machine, but I think it's still better priced than an Apple machine. Now it just has to hold up 10 years like the old one did ;)
[1nickt]: Ah, you got Linus' fave? With Ubuntu? 4k display?
[1nickt]: ( The 17" monster I just bought is for my wife, who doesn;t leave the house with it...)

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (9)
As of 2017-03-27 13:06 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (320 votes). Check out past polls.