Created
September 28, 2010 13:44
-
-
Save tadzik/601011 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my @s=<â ⣠⥠â¦>;my @r=2..10,<j q k a>;my %v=j=>10,:q(10),k=>10,a=>1|11;my @d=map {[$^a,$^b]},(@s X @r);@d.=pick(*);my @p=[],[];sub a(@c is rw){@c.unshift(@d.shift)};sub b(@c){my [email protected]({%v{.[1]}||.[1]}).reduce(*+*);$($v.grep({$_ <21}))||$v[0]};for @p {a($_);a($_);say '-'x 33;loop {if b($_)>21 {say $_~' is over 21';last};say b($_);say ~$_;last if prompt('(h) hit (s) sit? ')~~'s';a($_)}};say 'Winner: ',[max]@p.grep({b($_)<=21}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment