Advertisement
Guest User

Untitled

a guest
Mar 21st, 2013
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/perl
  2. use strict;
  3. use warnings;
  4.  
  5. my $bitcoin = "/home/diablo/code/bitcoin/bitcoin-0.8.1-linux/bin/64/bitcoind";
  6. my $start_btc = 33;
  7. my $bet_size = 1;
  8.  
  9. my $command = "listtransactions \"\" 99999999999999999";
  10. my $filter1 = "| grep amount | grep ";
  11. my $filter2 = " | wc -l";
  12.  
  13. my %search = (
  14.     64000 => '1.004',
  15.     60000 => '1.071',
  16.     56000 => '1.147',
  17.     52000 => '1.235',
  18.     48000 => '1.338',
  19.     32768 => '1.957',
  20.     0 => '0.005',
  21. );
  22.  
  23. my $count = 0.0;
  24. my $money = 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.     } else {
  37.         printf(" Fail: %4u tries = %8.3f BTC\n", $c, $m);
  38.     }
  39.  
  40.     $count += $c;
  41.     $money += $m;
  42. }
  43.  
  44. printf "\n";
  45.  
  46. printf("Total: %4u tries = %8.3f BTC\n", $count, $money);
  47.  
  48. my $avg_winnings = $money/$count;
  49.  
  50. printf("Average winning: %f%%\n", ($avg_winnings - 1) * 100);
  51.  
  52. my $winnings = $start_btc;
  53.  
  54. for(my $i = 0; $i < $count; $i += $winnings * $bet_size) {
  55.     $winnings *= $avg_winnings;
  56. }
  57.  
  58. printf("Actual winnings: %4.3f%%, %4.3f BTC -> %4.3f BTC\n", (($winnings / $start_btc) - 1) / 100, $start_btc, $winnings);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement