Bitcoin Forum
December 04, 2016, 08:21:49 AM *
News: Latest stable version of Bitcoin Core: 0.13.1  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: « 1 2 3 [4]  All
  Print  
Author Topic: Introducing Cardwars  (Read 6324 times)
BCEmporium
Legendary
*
Offline Offline

Activity: 938



View Profile
May 24, 2011, 03:23:46 PM
 #61

This one was at first try; 50 hands / bugged system - player gets full payout + 1 chip and just bets 0.01 to war:

Dealer Won: 26 hands
Player Won: 21 hands
Ties: 3 hands
Ties Won: 1 hands
Ties Lost: 2 hands
Player final balance: -4.03
     1st Card    2nd Card    3rd Card    4th Card
A   2   2   4   4
2   4   5   3   5
3   3   7   1   7
4   6   5   5   5
5   4   2   2   4
6   7   4   4   1
7   3   3   5   5
8   2   1   7   2
9   3   4   3   6
10   3   3   2   2
J   5   2   6   3
Q   6   3   5   3
K   2   9   3   3

Now... I may keep trying and will pull mostly player winnings, it's true, which is correct to the terms of the player edge to be about 6%, but also losses.

Second try:
Dealer Won: 27 hands
Player Won: 19 hands
Ties: 4 hands
Ties Won: 2 hands
Ties Lost: 2 hands
Player final balance: -4.04
     1st Card    2nd Card    3rd Card    4th Card
A   4   8   6   5
2   4   3   2   3
3   3   5   5   3
4   1   3   7   4
5   13   3   6   4
6   5   1   5   4
7   2   4   7   1
8   3   3   2   7
9   5   4   1   2
10   1   4   3   6
J   2   2   3   0
Q   5   5   2   3
K   2   5   1   8

3rd try;

Dealer Won: 24 hands
Player Won: 26 hands
Ties: 0 hands
Ties Won: 0 hands
Ties Lost: 0 hands
Player final balance: 2
     1st Card    2nd Card    3rd Card    4th Card
A   6   3   5   5
2   3   6   3   3
3   7   4   5   5
4   4   4   3   7
5   5   3   5   2
6   2   6   1   3
7   3   6   2   4
8   2   3   8   3
9   1   2   1   2
10   4   2   3   6
J   2   3   8   4
Q   5   4   5   2
K   6   4   1   4

4th try
Dealer Won: 27 hands
Player Won: 22 hands
Ties: 1 hands
Ties Won: 0 hands
Ties Lost: 1 hands
Player final balance: -6.01
     1st Card    2nd Card    3rd Card    4th Card
A   5   6   5   3
2   4   2   7   3
3   5   3   5   3
4   4   6   6   2
5   5   6   3   8
6   3   4   1   4
7   2   2   6   8
8   7   2   4   6
9   2   4   1   3
10   6   3   2   2
J   3   7   4   2
Q   2   3   4   3
K   2   2   2   3

The code:

Code:
<?php
set_time_limit
(10000);
function 
deal(){
          
$cartas = array("A","2","3","4","5","6","7","8","9","10","J","Q","K");
          
$naipes = array("c","s","d","h");
          
$baralho = array();
          foreach(
$cartas as $c){
              foreach(
$naipes as $n){
                  
$baralho[] = $c $n;
              }
          }
          
mt_srand(microtime() * 100000 rand());
          
shuffle($baralho); 
  return $baralho;
}
        function 
getCardValue($card){
            
$cv substr($card,0,1);
            
$cout 0;
            switch(
$cv){
                case 
'A'$cout 14; break;
                case 
'2'$cout 2; break;
                case 
'3'$cout 3; break;
                case 
'4'$cout 4; break;
                case 
'5'$cout 5; break;
                case 
'6'$cout 6; break;
                case 
'7'$cout 7; break;
                case 
'8'$cout 8; break;
                case 
'9'$cout 9; break;
                case 
'1'$cout 10; break;
                case 
'J'$cout 11; break;
                case 
'Q'$cout 12; break;
                case 
'K'$cout 13; break;
            }  
            return 
$cout;  
        } 

//ini_set("max_exec_time",60000);
$pwins 0;
$dwins 0;
$ties 0;
$twins 0;
$tlost 0;
$pbal 0;
$a 0;
$t 0;
$th 0;
$f 0;
$fi 0;
$s 0;
$se 0;
$e 0;
$n 0;
$te 0;
$j 0;
$q 0;
$k 0;
$a2 0;
$t2 0;
$th2 0;
$f2 0;
$fi2 0;
$s2 0;
$se2 0;
$e2 0;
$n2 0;
$te2 0;
$j2 0;
$q2 0;
$k2 0;
$a3 0;
$t3 0;
$th3 0;
$f3 0;
$fi3 0;
$s3 0;
$se3 0;
$e3 0;
$n3 0;
$te3 0;
$j3 0;
$q3 0;
$k3 0;
$a4 0;
$t4 0;
$th4 0;
$f4 0;
$fi4 0;
$s4 0;
$se4 0;
$e4 0;
$n4 0;
$te4 0;
$j4 0;
$q4 0;
$k4 0;
for(
$l 0$l $_REQUEST['draws']; $l++){
    
/*mt_srand(rand() + time() + microtime() * 100000);
$pclick = rand(1,2);
    mt_srand(rand() + time() + microtime() * 100000);
$server_delay = rand(0,1);*/
    
$cards deal();
    switch(
substr($cards[0],0,1)){
case "A"$a++; break;
case "2"$t++; break;
case "3"$th++; break;
case "4"$f++; break;
case "5"$fi++; break;
case "6"$s++; break;
case "7"$se++; break;
case "8"$e++; break;
case "9"$n++; break;
case "1"$te++; break;
case "J"$j++; break;
case "Q"$q++; break;
case "K"$k++; break;
    }

    switch(
substr($cards[1],0,1)){
case "A"$a2++; break;
case "2"$t2++; break;
case "3"$th2++; break;
case "4"$f2++; break;
case "5"$fi2++; break;
case "6"$s2++; break;
case "7"$se2++; break;
case "8"$e2++; break;
case "9"$n2++; break;
case "1"$te2++; break;
case "J"$j2++; break;
case "Q"$q2++; break;
case "K"$k2++; break;
    }

    switch(
substr($cards[2],0,1)){
case "A"$a3++; break;
case "2"$t3++; break;
case "3"$th3++; break;
case "4"$f3++; break;
case "5"$fi3++; break;
case "6"$s3++; break;
case "7"$se3++; break;
case "8"$e3++; break;
case "9"$n3++; break;
case "1"$te3++; break;
case "J"$j3++; break;
case "Q"$q3++; break;
case "K"$k3++; break;
    }

    switch(
substr($cards[3],0,1)){
case "A"$a4++; break;
case "2"$t4++; break;
case "3"$th4++; break;
case "4"$f4++; break;
case "5"$fi4++; break;
case "6"$s4++; break;
case "7"$se4++; break;
case "8"$e4++; break;
case "9"$n4++; break;
case "1"$te4++; break;
case "J"$j4++; break;
case "Q"$q4++; break;
case "K"$k4++; break;
    }

if(getCardValue($cards[0]) > getCardValue($cards[1])){
$pwins++;
$pbal++;
}elseif(getCardValue($cards[0]) < getCardValue($cards[1])){
$dwins++;
$pbal--;
}else{
        
$ties++;
if(getCardValue($cards[2]) >= getCardValue($cards[3])){
   $twins++;
   $pbal += 2.99;
}else{
$tlost++;
$pbal -= 1.01;
}
    }

//sleep($pclick + $server_delay);
}
?>

<p>
Dealer Won: <?php echo $dwins;?> hands<br/>
Player Won: <?php echo $pwins;?> hands<br/>
Ties: <?php echo $ties;?> hands<br/>
Ties Won: <?php echo $twins;?> hands<br/>
Ties Lost: <?php echo $tlost;?> hands<br/>
Player final balance: <?php echo $pbal;?>
</p>
<table>
<tr>
<td>&nbsp;</td>
<td>1st Card</td>
<td>2nd Card</td>
<td>3rd Card</td>
<td>4th Card</td>
</tr>
<tr><td>A</td><td align="center"><?php echo $a;?></td><td align="center"><?php echo $a2;?></td><td align="center"><?php echo $a3;?></td><td align="center"><?php echo $a4;?></td></tr>
<tr><td>2</td><td align="center"><?php echo $t;?></td><td align="center"><?php echo $t2;?></td><td align="center"><?php echo $t3;?></td><td align="center"><?php echo $t4;?></td></tr>
<tr><td>3</td><td align="center"><?php echo $th;?></td><td align="center"><?php echo $th2;?></td><td align="center"><?php echo $th3;?></td><td align="center"><?php echo $th4;?></td></tr>
<tr><td>4</td><td align="center"><?php echo $f;?></td><td align="center"><?php echo $f2;?></td><td align="center"><?php echo $f3;?></td><td align="center"><?php echo $f4;?></td></tr>
<tr><td>5</td><td align="center"><?php echo $fi;?></td><td align="center"><?php echo $fi2;?></td><td align="center"><?php echo $fi3;?></td><td align="center"><?php echo $fi4;?></td></tr>
<tr><td>6</td><td align="center"><?php echo $s;?></td><td align="center"><?php echo $s2;?></td><td align="center"><?php echo $s3;?></td><td align="center"><?php echo $s4;?></td></tr>
<tr><td>7</td><td align="center"><?php echo $se;?></td><td align="center"><?php echo $se2;?></td><td align="center"><?php echo $se3;?></td><td align="center"><?php echo $se4;?></td></tr>
<tr><td>8</td><td align="center"><?php echo $e;?></td><td align="center"><?php echo $e2;?></td><td align="center"><?php echo $e3;?></td><td align="center"><?php echo $e4;?></td></tr>
<tr><td>9</td><td align="center"><?php echo $n;?></td><td align="center"><?php echo $n2;?></td><td align="center"><?php echo $n3;?></td><td align="center"><?php echo $n4;?></td></tr>
<tr><td>10</td><td align="center"><?php echo $te;?></td><td align="center"><?php echo $te2;?></td><td align="center"><?php echo $te3;?></td><td align="center"><?php echo $te4;?></td></tr>
<tr><td>J</td><td align="center"><?php echo $j;?></td><td align="center"><?php echo $j2;?></td><td align="center"><?php echo $j3;?></td><td align="center"><?php echo $j4;?></td></tr>
<tr><td>Q</td><td align="center"><?php echo $q;?></td><td align="center"><?php echo $q2;?></td><td align="center"><?php echo $q3;?></td><td align="center"><?php echo $q4;?></td></tr>
<tr><td>K</td><td align="center"><?php echo $k;?></td><td align="center"><?php echo $k2;?></td><td align="center"><?php echo $k3;?></td><td align="center"><?php echo $k4;?></td></tr>

</table>

I took 4 draws in a row with the player being down 3 times even with edge going highly on his way. Now tell me what's the odds for this to happen.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
tomcollins
Full Member
***
Offline Offline

Activity: 182


View Profile
May 24, 2011, 03:34:28 PM
 #62

No, I did nothing to test server, it is today what it was yesterday. No updates made, nothing changed there. If the results come different it may only mean your luck has changed on drawing it.
Also I could draw within less than 10 tries, didn't took 200K tries to get it, simulations where the player was down to -15 or less by 50 hands played.
That bug was from a CVS version of PHP back in 2002, PHP5.2 is far younger than that, the other bug was from 2000 and PHP 4.0.1.

Under your logic, folks winning lotto should be returning the money, as the odds against winning such thing is over 50,000,000:1... and still sometimes happens.

And you're applying gambler's fallacy there, you're stating the odds after 500 hands assuming you'll play 500 hands when you can well be down at 50 or 100, each time gamblers' gamble it also counts how much or how longer his chip stack will hold. Otherwise that "lose and double" Blackjack "scheme" would work, as sooner or later you'll win a hand, question is if you have a limitless stack to hold that long.

I'm not saying any such things.

I'm saying use Bayes Theorem.

If only one guy plays the lotto, and he wins right away, yes, it probably is rigged.  If 10 million people play, and someone hits, it's far less likely that it's rigged.

If I run a simulation, if I don't apply every possibility (well, if you get below 15 bets, you quit), you dismiss it.  I'll run that test if you want.  But say it's 150,000:1 against that happening in a legit deck.  You'll just say "oh well you had bad luck, so sorry!"  It is impossible to provide enough proof to you.  I wish you would have let me know that no proof would be good enough before I wasted my time.

How could you ever prove something is rigged?  In your case, run a million samples, and if it shows a pattern the wrong way "oh, I guess you were just unlucky!"  There is no way you would ever accept any evidence no matter what.  You are taking out the fact that you got exploited by someone else out on me.

Yes, over the short term, being down 4-5 bets is not unreasonable.  You only will hit a few ties, and the player edge exists on the tie scenario.  Getting down 15 bets is MUCH harder.  Getting down 30 bets is EXTREMELY hard.  So yes, what you are showing is not hard at all to have happen.  BUT THAT'S NOT WHAT HAPPENED.  A much bigger downswing happened.  The distribution of the cards was EXACTLY the result of the PHP bug that I found where shuffling was flawed (cards tend to be much closer to their original shuffling positions, which make the dealer, who gets the 2nd card, much more likely to get a higher card).  Everything makes sense.

I have no idea why you run 50 sample size, it's noise at that point.  And even then, you never run so badly that you get down 15 bets or 30 bets.

I'll give you the exact odds, but being down after 50 samples is probably about 40-45%.  I'll have to run the math to simulate it, and I don't have that computer with me now.  So the odds of your scenario happening (lose 3/4) is 20% based on that number.  20% vs. 0.000036% is a huge difference.

So tell me this, what, if anything, could convince you of a problem that you could not blame on "bad luck"?  Is there anything other than an obvious payout problem (you win but never get paid any chips, or only half the proper amount)?
BCEmporium
Legendary
*
Offline Offline

Activity: 938



View Profile
May 24, 2011, 03:42:11 PM
 #63

If cards tend to be closer to original position, then you would most likely run into a lot of draws, as the original non-shuffled deck position is:
As Ah Ac Ad 2s 2h 2c 2d(...)
tomcollins
Full Member
***
Offline Offline

Activity: 182


View Profile
May 24, 2011, 03:48:48 PM
 #64

If cards tend to be closer to original position, then you would most likely run into a lot of draws, as the original non-shuffled deck position is:
As Ah Ac Ad 2s 2h 2c 2d(...)


This may be true.  The flaw I found made cards near yours about 2x as likely as cards further away.

So the odds of getting an ace, 2, 3, 4 were all quite similar, and the odds of getting a 10, J, Q, K were lower (although not impossible to get).

I'd have to see what the odds of getting a tie was.  The odds of normally getting a tie are 1/17.  In the sample file you sent me yesterday, there were 14 draws out of 216 hands.  I would expect 12.7, so it would be a bit higher, although it's not statistically significant enough to know for sure.  I have no idea what the expected value based on the improper shuffling algorithm would be, but if needed, I could calculate this.
BCEmporium
Legendary
*
Offline Offline

Activity: 938



View Profile
May 24, 2011, 07:07:44 PM
 #65

The more proper the shuffling is, the less likely you get any possible match of patterns. That's what shuffling is meant to do in gamble: Add a random factor which normally people calls luck.

I don't see such "hardness" or "less likely" to come out of the 8~K group against A~7. I don't see a card or a pattern to pin it down on shuffling. Want me to go count on suits too?! That can be done...

On that day, you and luv2 were playing at the same time, you'd 98 funchips, he had 260. Both started with 100. What to say?
The influence of the bug was that player got overpaid, so you dealt a surplus of 4 or 5 hands before losing the stack.

PS - I really loved to do why the forum keeps showing me "another post at less than 0 seconds from your IP"...
tomcollins
Full Member
***
Offline Offline

Activity: 182


View Profile
May 24, 2011, 08:16:16 PM
 #66

The more proper the shuffling is, the less likely you get any possible match of patterns. That's what shuffling is meant to do in gamble: Add a random factor which normally people calls luck.

I don't see such "hardness" or "less likely" to come out of the 8~K group against A~7. I don't see a card or a pattern to pin it down on shuffling. Want me to go count on suits too?! That can be done...

On that day, you and luv2 were playing at the same time, you'd 98 funchips, he had 260. Both started with 100. What to say?
The influence of the bug was that player got overpaid, so you dealt a surplus of 4 or 5 hands before losing the stack.

PS - I really loved to do why the forum keeps showing me "another post at less than 0 seconds from your IP"...

Of course I know what shuffling is.  Of course you don't see it, you don't know how to look for it.  You refuse to run my code on the production server to try to detect the problem.  And even if you did, and 2's were twice as likely as Ks to come up for the user over a million trials, you'd just blame it on bad luck.

I'm not going to waste any more time until you give me something that could be sufficiently done to convince you.  You intend to keep my money because someone else took advantage of your sloppy coding and testing.  So I ask you this- what could convince you otherwise?

I show you something that's 1 in 277,000 in happening, it's just bad luck.  I show you a bug report, it clearly is impossible for any bugs to exist.  I find several bugs in your code that benefited the player, but the rest of your code must be perfect (and all of php libraries you call into).

So tell me this, give me an example of something I could actually do to show you that the deal was unfair without you blaming it on bad luck?  If it is nothing, then let me know so I quit wasting my time.  You don't seem interested in actually detecting anything, just finding an excuse to push me off.  If that's the case, just be honest about it.
BCEmporium
Legendary
*
Offline Offline

Activity: 938



View Profile
May 24, 2011, 08:24:55 PM
 #67

I'm yet to see 2's to come out twice as much as K's.
They might do one time and the other way around the next.

I uploaded your code to the main server, I'll PM you the address.
BCEmporium
Legendary
*
Offline Offline

Activity: 938



View Profile
May 24, 2011, 08:32:55 PM
 #68

1K Draws from production server (the payouts are debugged code already):

Dealer Won: 476 hands
Player Won: 450 hands
Ties: 74 hands
Ties Won: 41 hands
Ties Lost: 33 hands
Player final balance: -51
     1st Card    2nd Card    3rd Card    4th Card
A   80   83   64   75
2   67   70   62   82
3   70   80   68   92
4   79   76   94   65
5   81   87   74   67
6   75   82   76   89
7   64   48   94   82
8   81   79   89   69
9   92   83   86   72
10   71   76   80   70
J   73   74   63   81
Q   84   94   74   78
K   83   68   76   78

Don't see any 2:1 on 2:K, actually it drew fewer 2's than K's

5000 draws:

Dealer Won: 2336 hands
Player Won: 2343 hands
Ties: 321 hands
Ties Won: 176 hands
Ties Lost: 145 hands
Player final balance: -107
     1st Card    2nd Card    3rd Card    4th Card
A   389   362   371   348
2   377   409   377   425
3   375   350   424   396
4   363   405   380   429
5   374   368   359   378
6   380   354   371   382
7   404   399   381   389
8   408   378   392   384
9   408   407   355   362
10   389   413   409   388
J   391   405   396   363
Q   377   373   394   372
K   365   377   391   384

Now you got more 2's than K's not even close to 2:1 however.
tomcollins
Full Member
***
Offline Offline

Activity: 182


View Profile
May 24, 2011, 08:40:26 PM
 #69

I have looked at the results of my code, everything looks on the up and up right now for the shuffling.  Perhaps I am just super unlucky!

With the level of cooperation I have gotten from BCE, it is very unlikely he is scamming me, and just protecting himself up from exploiters.

I've run out of ideas about what possibly could be wrong, so unless he is super devious and running different code than what he's publishing, I was either unlucky or it's some super obscure problem that I cannot figure out.

Thanks for putting up with me BCE and investigating this.  Not much else I think I can think of or notice what is wrong.
luv2drnkbr
Hero Member
*****
Offline Offline

Activity: 771



View Profile
May 25, 2011, 11:50:26 AM
 #70

The more proper the shuffling is, the less likely you get any possible match of patterns. That's what shuffling is meant to do in gamble: Add a random factor which normally people calls luck.

I don't see such "hardness" or "less likely" to come out of the 8~K group against A~7. I don't see a card or a pattern to pin it down on shuffling. Want me to go count on suits too?! That can be done...

On that day, you and luv2 were playing at the same time, you'd 98 funchips, he had 260. Both started with 100. What to say?
The influence of the bug was that player got overpaid, so you dealt a surplus of 4 or 5 hands before losing the stack.

PS - I really loved to do why the forum keeps showing me "another post at less than 0 seconds from your IP"...

Please stop saying this like it means something.  I was betting 10 per hand, he was betting at most 1 or 2.

luv2drnkbr
Hero Member
*****
Offline Offline

Activity: 771



View Profile
May 25, 2011, 12:02:02 PM
 #71

Under your logic, folks winning lotto should be returning the money, as the odds against winning such thing is over 50,000,000:1... and still sometimes happens.

And you're applying gambler's fallacy there, you're stating the odds after 500 hands assuming you'll play 500 hands when you can well be down at 50 or 100, each time gamblers' gamble it also counts how much or how longer his chip stack will hold. Otherwise that "lose and double" Blackjack "scheme" would work, as sooner or later you'll win a hand, question is if you have a limitless stack to hold that long.

You're talking about gambling fallacies when you've stated the odds of winning the lotto to be 50M:1, and when you keep flaunting my 160 funchip win when I was betting 10x the amount tom was, and when you made a statement earlier in the thread about how the odds are roughly the same for player and casino and ties aren't common anyway, so there's no need to worry about who has a small edge one way or another.  Then to top it all off, your magnum opus, you tested your code by running 50 HAND SAMPLES.

Saying tom is committing a gambling fallacy reminds me of something a pot once called a kettle...

I'm sorry to be mean, but you really have no business operating a casino.

BCEmporium
Legendary
*
Offline Offline

Activity: 938



View Profile
May 25, 2011, 12:18:14 PM
 #72

Sorry to speak out your score, no need to be that angry for that...
So you were betting 10x... and? To the very end you were over your initial stack, he was under. Betting like you would be -20, or you betting like him would be +16. It's not to apply any fallacy there, just a simple statement that one was winning the other not... I call such luck because you were running the very same algorithm at almost the same time.
I did not test it over 50 hand draws, the simulator can draw as many hands as I want, you've there 1000 hands, 5000 hands, the test net even ran 1,000,000 hands several times.
luv2drnkbr
Hero Member
*****
Offline Offline

Activity: 771



View Profile
May 26, 2011, 02:12:11 AM
 #73

I don't mind you speaking out my score..  I mind you saying

Quote
On that day, you and luv2 were playing at the same time, you'd 98 funchips, he had 260. Both started with 100. What to say?

without noting that I was betting 10 times as much as tom.  That's purposefully trying to misrepresent the swinginess if your game.

BCEmporium
Legendary
*
Offline Offline

Activity: 938



View Profile
May 26, 2011, 10:26:20 AM
 #74

No, it would be a fallacy if I imply that "because you were winning he was losing" or vice-versa, taken those are totally unrelated, nor justify anyone's winnings or losses. I was simply stating that wasn't an "unbeaten machine", winning or loosing "just happens".
As for the initial questions, I gave "non-answers" because I don't recall to see any casino with a saying over the roulette «Lose money here! House edge is >5%»...
tomcollins
Full Member
***
Offline Offline

Activity: 182


View Profile
May 26, 2011, 08:04:15 PM
 #75

No, it would be a fallacy if I imply that "because you were winning he was losing" or vice-versa, taken those are totally unrelated, nor justify anyone's winnings or losses. I was simply stating that wasn't an "unbeaten machine", winning or loosing "just happens".
As for the initial questions, I gave "non-answers" because I don't recall to see any casino with a saying over the roulette «Lose money here! House edge is >5%»...

The roulette table must provide a list of what all the payouts are for each type of bet, and you can easily figure them out for yourself (if you wish).
Pages: « 1 2 3 [4]  All
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!