Advertisement
grimnebulin

Card game simulation

Jan 8th, 2017
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 6 0.21 KB | None | 0 0
  1. sub loses(@deck) {
  2.     grep { ($^index - $^value) %% 13 }, @deck.kv;
  3. }
  4.  
  5. my $trials = 1000000;
  6. my $won = 0;
  7.  
  8. for ^$trials {
  9.     ++$won if !loses((^52).pick(*));
  10. }
  11.  
  12. say 'Won ', $won / $trials * 100, '%';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement