Title: Gambling: Bitcoin Darts
Post by: mizerydearia on January 01, 2011, 10:24:46 AM
I encountered Bitcoin Darts (http://bitcoindarts.movoda.net/) and played a total of ten times each for 0.1btc. I came out ahead by 0.41btc. So I decided to investigate further the odds of winning. I analyzed the PNG image and noticed a bit of antialiasing and also a bit of green bleeding into the bullseye area. Additionally I wasn't certain how to evaluate the black pixels, whether they are to be included and if so which color to evaluate it as. I figured perhaps the code is designed to regenerate a position if black is picked. Additionally I wasn't certain how the code would handle antialiased pixels that do not match the exact rgb value of the majority of colors, so I recreated another image with no antialiasing that I then wrote a script and parsed the data from. Attached is the image I produced and below is a PHP script I wrote to gather and output the following data: <?php $im = @imagecreatefrompng("5x2ki8jf.png"); $imx = imagesx($im); $imy = imagesy($im);
$odds = 65535;
$pixels = array( "Bullseye" => array("count" => 0, "pays" => 5), "Double Bullseye" => array("count" => 0, "pays" => 10), "Blue" => array("count" => 0, "pays" => 2), "Blue Inner" => array("count" => 0, "pays" => 6), "Blue Outer" => array("count" => 0, "pays" => 4), "Purple" => array("count" => 0, "pays" => 1.2), "Purple Inner" => array("count" => 0, "pays" => 3.6), "Purple Outer" => array("count" => 0, "pays" => 2.4), "Cyan" => array("count" => 0, "pays" => 1), "Cyan Inner" => array("count" => 0, "pays" => 3), "Cyan Outer" => array("count" => 0, "pays" => 2), "Red" => array("count" => 0, "pays" => .5), "Red Inner" => array("count" => 0, "pays" => 1.5), "Red Outer" => array("count" => 0, "pays" => 1), "Green" => array("count" => 0, "pays" => .2), "Green Inner" => array("count" => 0, "pays" => .6), "Green Outer" => array("count" => 0, "pays" => .4), "Outside" => array("count" => 0, "pays" => 0), "Black" => array("count" => 0, "pays" => 0) );
for ($y = 0; $y <= $imy; $y++) { for ($x = 0; $x <= $imx; $x++) { $color_index = imagecolorat($im, $x, $y); $color = imagecolorsforindex($im, $color_index); $r = $color["red"]; $g = $color["green"]; $b = $color["blue"]; $a = $color["alpha"]; if ($r == 0 && $g == 0 && $b == 0 && $a == 127) $pixels["Outside"]["count"]++; else if ($r == 0 && $g == 0 && $b == 0 && $a == 0) $pixels["Black"]["count"]++; else if ($r == 74 && $g == 74 && $b == 255 && $a == 0) $pixels["Blue Outer"]["count"]++; else if ($r == 255 && $g == 66 && $b == 66 && $a == 0) $pixels["Red Outer"]["count"]++; else if ($r == 130 && $g == 254 && $b == 255 && $a == 0) $pixels["Cyan Outer"]["count"]++; else if ($r == 255 && $g == 74 && $b == 253 && $a == 0) $pixels["Purple Outer"]["count"]++; else if ($r == 0 && $g == 0 && $b == 255 && $a == 0) $pixels["Blue"]["count"]++; else if ($r == 255 && $g == 0 && $b == 0 && $a == 0) $pixels["Red"]["count"]++; else if ($r == 0 && $g == 252 && $b == 255 && $a == 0) $pixels["Cyan"]["count"]++; else if ($r == 255 && $g == 0 && $b == 252 && $a == 0) $pixels["Purple"]["count"]++; else if ($r == 77 && $g == 255 && $b == 77 && $a == 0) $pixels["Green Outer"]["count"]++; else if ($r == 0 && $g == 255 && $b == 0 && $a == 0) $pixels["Green"]["count"]++; else if ($r == 0 && $g == 0 && $b == 180 && $a == 0) $pixels["Blue Inner"]["count"]++; else if ($r == 189 && $g == 0 && $b == 0 && $a == 0) $pixels["Red Inner"]["count"]++; else if ($r == 0 && $g == 179 && $b == 181 && $a == 0) $pixels["Cyan Inner"]["count"]++; else if ($r == 181 && $g == 0 && $b == 179 && $a == 0) $pixels["Purple Inner"]["count"]++; else if ($r == 0 && $g == 181 && $b == 0 && $a == 0) $pixels["Green Inner"]["count"]++; else if ($r == 189 && $g == 125 && $b == 0 && $a == 0) $pixels["Bullseye"]["count"]++; else if ($r == 255 && $g == 168 && $b == 0 && $a == 0) $pixels["Double Bullseye"]["count"]++; //else if ($r == && $g == && $b == && $a == 0) $pixels[""]["count"]++; else echo "$r $g $b $a<br>"; } } echo "<table><tr><th>Color</th><th># Pixels</th><th>Chance</th><th>Payout</th></tr>"; foreach ($pixels as $color => $data) { ?> <tr> <td><?php echo $color; ?></td> <td><?php echo $data["count"]; ?></td> <td><?php echo number_format($data["count"] / $odds * 100, 2); ?>%</td> <td><?php echo $data["pays"] * 100; ?>%</td> </tr> <?php } ?> </table> Color # Pixels Chance Payout Double Bullseye 72 0.11% 1000% Blue Inner 655 1.00% 600% Bullseye 440 0.67% 500% Blue Outer 760 1.16% 400% Purple Inner 780 1.19% 360% Cyan Inner 839 1.28% 300% Purple Outer 923 1.41% 240% Blue 4796 7.32% 200% Cyan Outer 984 1.50% 200% Red Inner 792 1.21% 150% Purple 5622 8.58% 120% Cyan 6173 9.42% 100% Red Outer 958 1.46% 100% Green Inner 1122 1.71% 60% Red 5812 8.87% 50% Green Outer 1282 1.96% 40% Green 8196 12.51% 20% Outside 16156 24.65% 0% Black 9687 14.78% ?% Chances of winning or breaking even: 0.11 + 1.00 + 0.67 + 1.16 + 1.19 + 1.28 + 1.41 + 7.32 + 1.50 + 1.21 + 8.58 + 9.42 + 1.46 = 36.31% Chances of losing: 1.71 + 8.87 + 1.96 + 12.51 + 24.65 + 14.78 = 64.48% Otherwise if as suggested above, black pixels are not included, then Color # Pixels Chance Payout Double Bullseye 72 0.13% 1000% Blue Inner 655 1.17% 600% Bullseye 440 0.79% 500% Blue Outer 760 1.36% 400% Purple Inner 780 1.40% 360% Cyan Inner 839 1.50% 300% Purple Outer 923 1.65% 240% Blue 4796 8.59% 200% Cyan Outer 984 1.76% 200% Red Inner 792 1.42% 150% Purple 5622 10.07% 120% Cyan 6173 11.05% 100% Red Outer 958 1.72% 100% Green Inner 1122 2.01% 60% Red 5812 10.41% 50% Green Outer 1282 2.30% 40% Green 8196 14.68% 20% Outside 16156 28.93% 0% Chances of winning or breaking even: 0.13 + 1.17 + 0.79 + 1.36 + 1.40 + 1.50 + 1.65 + 8.59 + 1.76 + 1.42 + 10.07 + 11.05 + 1.72 = 42.61% Chances of losing: 2.01 + 10.41 + 2.30 + 14.68 + 28.93 = 58.33% Note: The site was also mentioned a few times: originally here (http://bitcointalk.org/index.php?topic=1069.0), laterly here (http://bitcointalk.org/index.php?topic=1565.msg18509#msg18509), more laterly here (http://bitcointalk.org/index.php?topic=2049.msg26396#msg26396), even more laterly here (http://bitcointalk.org/index.php?topic=2404.msg32599#msg32599) and second to lastly here (http://bitcointalk.org/index.php?topic=2448.0) but not here (http://bitcointalk.org/index.php?topic=547.0). Also Statistics (http://bitcoindarts.webs.com/)
Title: Re: Gambling: Bitcoin Darts
Post by: bitcoinex on January 08, 2011, 04:12:36 AM
my calculations:
chance * payot + ... + chance * payot = ~0.69%
Title: Re: Gambling: Bitcoin Darts
Post by: Mahkul on January 08, 2011, 03:13:23 PM
It would be nice if someone ported this to facebook and the likes.
Title: Re: Gambling: Bitcoin Darts
Post by: bitcoinex on January 08, 2011, 04:47:15 PM
It would be nice if someone ported this to facebook and the likes.
I think this is prohibited by facebook rules
Title: Re: Gambling: Bitcoin Darts
Post by: Gluskab on April 15, 2011, 08:36:40 AM
my calculations:
chance * payot + ... + chance * payot = ~0.69%
I got .89 for the "Not including black" table and .76 for the other one.
Title: Re: Gambling: Bitcoin Darts
Post by: mskwik on April 15, 2011, 03:18:44 PM
The black outline is actually a layer over the board part that is used to calculate the outcome, so the black pixels are calculated as the color underneath. The official calculation is done from a database table that was made at the same time as the image by dumping the section information when they were still separate layers as well, so the edges where they run into each other may not match the image exactly. I've always done stats calculations off the database and just considered the image as a visual, so far I've only had to adjust the database once when it called a pixel that was clearly well off the board as a double bullseye (must have had a stray pixel on that layer) I think I've shared the board stats before but not sure where so I will pull them again, just to give an "official" number to compare your stats to. (Not that there's any sure way for you to verify this, but it's where my payout numbers come from) mysql> select darts_section.comment,darts_section.amtback,count(darts_section.id) from darts_board left join darts_section on darts_board.section=darts_section.id group by darts_section.id order by amtback desc; +-----------------+---------+-------------------------+ | comment | amtback | count(darts_section.id) | +-----------------+---------+-------------------------+ | Double Bullseye | 1000 | 116 | | Blue Triple | 600 | 781 | | Bullseye | 500 | 566 | | Blue Double | 400 | 1226 | | Purple Triple | 360 | 1006 | | Cyan Triple | 300 | 1026 | | Purple Double | 240 | 1555 | | Blue | 200 | 5221 | | Cyan Double | 200 | 1600 | | Red Triple | 150 | 972 | | Purple | 120 | 7076 | | Cyan | 100 | 7116 | | Red Double | 100 | 1556 | | Green Triple | 60 | 1259 | | Red | 50 | 6632 | | Green Double | 40 | 2194 | | Green | 20 | 8365 | | Off the Board | 0 | 17269 | +-----------------+---------+-------------------------+ 18 rows in set (0.30 sec)
mysql> select darts_section.comment,darts_section.amtback*count(darts_section.id)/65536 as payoutpct from darts_board left join darts_section on darts_board.section=darts_section.id group by darts_section.id order by amtback desc; +-----------------+-----------+ | comment | payoutpct | +-----------------+-----------+ | Double Bullseye | 1.7700 | | Blue Triple | 7.1503 | | Bullseye | 4.3182 | | Blue Double | 7.4829 | | Purple Triple | 5.5261 | | Cyan Triple | 4.6967 | | Purple Double | 5.6946 | | Blue | 15.9332 | | Cyan Double | 4.8828 | | Red Triple | 2.2247 | | Purple | 12.9565 | | Cyan | 10.8582 | | Red Double | 2.3743 | | Green Triple | 1.1526 | | Red | 5.0598 | | Green Double | 1.3391 | | Green | 2.5528 | | Off the Board | 0.0000 | +-----------------+-----------+ 18 rows in set (0.25 sec)
Which should add up to the 96% that I normally give as the average payout % And just for good measure (without actual totals) mysql> select sum(amountout)/sum(amountin) from darts_transaction where status>7; +------------------------------+ | sum(amountout)/sum(amountin) | +------------------------------+ | 0.943374072162 | +------------------------------+ 1 row in set (0.00 sec)
Gotten enough plays now that it doesn't vary too much anymore, mostly tends to drift down slowly with upward jumps when someone wins big.
Title: Re: Gambling: Bitcoin Darts
Post by: doldoltom12 on September 01, 2013, 09:05:40 PM
|