Advertisement
Guest User

Untitled

a guest
Mar 21st, 2013
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 1.04 KB | None | 0 0
  1. #!/usr/bin/perl
  2. use strict;
  3. use warnings;
  4.  
  5. my $bitcoin = "/path/to/bitcoind";
  6. my $command = "listtransactions \"\" 99999999999999999";
  7. my $filter1 = "| grep amount | grep ";
  8. my $filter2 = " | wc -l";
  9.  
  10. my %search = (
  11.     64000 => '1.004',
  12.     60000 => '1.071',
  13.     56000 => '1.147',
  14.     52000 => '1.235',
  15.     48000 => '1.338',
  16.     32768 => '1.957',
  17.     0 => '0.005',
  18. );
  19.  
  20.  
  21. my $count = 0.0;
  22. my $money = 0.0;
  23. my $winnings = 1.0;
  24. my $lost = 0.0;
  25.  
  26. foreach my $level (sort { $search{$a} <=> $search{$b} } keys %search) {
  27.     my $amount = $search{$level};
  28.  
  29.     my $c = `$bitcoin $command $filter1 $amount $filter2`;
  30.     my $m = $c * $amount;
  31.  
  32.     $c =~ s/\n//;
  33.  
  34.     if($level != 0) {
  35.         printf("%5u: %4u tries = %8.3f BTC\n", $level, $c, $m);
  36.         $winnings *= $amount;
  37.     } else {
  38.         printf(" Fail: %4u tries = %8.3f BTC\n", $c, $m);
  39.         $lost++;
  40.     }
  41.  
  42.     $count += $c;
  43.     $money += $m;
  44. }
  45.  
  46. printf "\n";
  47.  
  48. printf("Total: %4u tries = %8.3f BTC\n", $count, $money);
  49. printf("Average winning: %f%%\n", (($money/$count) - 1) * 100);
  50. printf("Actual winnings: %f%%\n", $winnings - $lost);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement