View difference between Paste ID: Sw5vbxre and wPNUKYmy
SHOW: | | - or go back to the newest paste.
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";
6+
my $start_btc = 33;
7
8
my $command = "listtransactions \"\" 99999999999999999";
9
my $filter1 = "| grep amount | grep ";
10
my $filter2 = " | wc -l";
11
12
my %search = (
13
	64000 => '1.004',
14
	60000 => '1.071',
15
	56000 => '1.147',
16
	52000 => '1.235',
17
	48000 => '1.338',
18
	32768 => '1.957',
19
	0 => '0.005',
20
);
21
22
my $count = 0.0;
23
my $money = 0.0;
24
25
foreach my $level (sort { $search{$a} <=> $search{$b} } keys %search) {
26
	my $amount = $search{$level};
27
28
	my $c = `$bitcoin $command $filter1 $amount $filter2`;
29
	my $m = $c * $amount;
30
31
	$c =~ s/\n//;
32
33
	if($level != 0) {
34
		printf("%5u: %4u tries = %8.3f BTC\n", $level, $c, $m);
35
	} else {
36
		printf(" Fail: %4u tries = %8.3f BTC\n", $c, $m);
37
	}
38
39
	$count += $c;
40
	$money += $m;
41
}
42
43
printf "\n";
44
45
printf("Total: %4u tries = %8.3f BTC\n", $count, $money);
46
47-
my $avg_winnings =$money/$count;
47+
my $avg_winnings = $money/$count;
48
49-
printf("Average winning: %f%%\n", (($avg_winnings - 1) * 100));
49+
printf("Average winning: %f%%\n", ($avg_winnings - 1) * 100);
50
51
my $winnings = $start_btc;
52
53-
for(my $i = 0; $i < $count; $i += $winnings - $start_btc) {
53+
for(my $i = 0; $i < $count; $i += $winnings) {
54
	$winnings *= $avg_winnings;
55
}
56
57-
printf("Actual winnings: %f%%\n", $winnings);
57+
printf("Actual winnings: %4.3f%%, %4.3f BTC -> %4.3f BTC\n", ($winnings - 1) * 100, $start_btc, $start_btc * $winnings);