Bitcoin Forum

Economy => Marketplace => Topic started by: BCEmporium on May 22, 2011, 03:05:26 PM



Title: Introducing Cardwars
Post by: BCEmporium on May 22, 2011, 03:05:26 PM
Just added a new table game to the site, it's name is "Cardwars", you can find it near Blackjack at www.bityacht.com (Casino)

Rules of Cardwars:

Cardwars is the simplest table card game of a casino. Dealer gives you a card, takes a card himself and the one with bigger card face wins - suit doesn't matter.
Card values from higher to lower are: Ace - King - Queen - Jack - Ten - 9 - 8 - 7 - 6 - 5 - 4 - 2

If both have a card with the same value then the player must choose if he surrenders or goes to war.

Surrender:
The player gets back 50% of his ante

War:
The player adds a bet of equal value to his ante (if the player's ante was 0.1, the bet will be 0.1 also)
3 cards are burnt by the dealer, the 4th card goes to the player, 5th to the dealer.
Again the one with the higher card wins.
If card values are equal player wins.

Tie bet:

In the middle there's a red circle to bet for tie. Tie pays 10:1. A tie is won if the dealer and the player have cards of same value, regardless if the player choose to surrender or to war.

Here's a screenshot:

http://www.bityacht.com/screens/cardwars.jpg


Title: Re: Introducing Cardwars
Post by: TehZomB on May 22, 2011, 05:21:33 PM
Ah, so is this the Casino version of the traditional War card game?


Title: Re: Introducing Cardwars
Post by: BCEmporium on May 22, 2011, 05:27:42 PM
Based on, yes.
But battles are quite different, as the battle cards are burnt being only the last one played, with advantage to player (on re-tie, the player wins).

http://en.wikipedia.org/wiki/Casino_war


Title: Re: Introducing Cardwars
Post by: eturnerx on May 22, 2011, 06:52:37 PM
I'm not seeing where the house's edge is - and that bothers me. Basically when the cards tie - if the player surrenders the house gets half an ante. If they go to war then the player gets a 7/13 to 6/13 (1/13) advantage over the house. So never surrender and slowly win?
I'm really suspicious when I don't see how the casino is paying their power bills - makes me wonder if I'll ever walk out with my watch, wallet and shoes.


Title: Re: Introducing Cardwars
Post by: BCEmporium on May 22, 2011, 07:21:05 PM
For that to happen, ties would need to be quite common. Other than that you've the tie bet. This game doesn't give the house a quite good edge as blackjack does, it's true, as odds are roughly 46,3% to both sides.
Still, the amounts in play may make you sure that you'll always come out with your watch, wallet and shoes.


Title: Re: Introducing Cardwars
Post by: luv2drnkbr on May 22, 2011, 10:31:23 PM
Is the "deck" shuffled after each hand?  Also, as somebody pointed out, with players winning war ties, this has an edge for the player, so you wouldn't mind if I just played this day and night (or got a bot to play it) and grinded out minimum wage would you?  I've made a lot of money on less than 0.8% edges in my time.  (0.8% is about what your game is worth.)


Title: Re: Introducing Cardwars
Post by: BCEmporium on May 22, 2011, 10:38:22 PM
The deck is shuffled on the beginning of each hand. Counting cards would do you no good there.
I'm keeping an eye over this game to see how it stands.


Title: Re: Introducing Cardwars
Post by: luv2drnkbr on May 22, 2011, 10:42:44 PM
For that to happen, ties would need to be quite common. Other than that you've the tie bet. This game doesn't give the house a quite good edge as blackjack does, it's true, as odds are roughly 46,3% to both sides.
Still, the amounts in play may make you sure that you'll always come out with your watch, wallet and shoes.

This reeks of ignorance about how gambling works, and if you don't understand how gambling works, you really shouldn't be running a casino.

Roughly 1/(13^2) of the time (actually a little less often), you're going to lose two units.  If we assume that a hand takes ten seconds to play, that means you'll get about 360 hands per hour, that means this will happen on average just about twice per hour.  So a person betting just 1 BTC per wager figures to profit, at current exchange rates, about 25 USD per hour by just clicking the "deal" button as fast as possible.

If you don't think this is a problem, that's fantastic and I will be a long and continuing customer of your Cardwars game.


Title: Re: Introducing Cardwars
Post by: tomcollins on May 22, 2011, 10:46:54 PM
For that to happen, ties would need to be quite common. Other than that you've the tie bet. This game doesn't give the house a quite good edge as blackjack does, it's true, as odds are roughly 46,3% to both sides.
Still, the amounts in play may make you sure that you'll always come out with your watch, wallet and shoes.

Do you take a commission on won ties?  I bet 10 BTC in play money, tied, won, then got 19.90BTC back.


Title: Re: Introducing Cardwars
Post by: luv2drnkbr on May 22, 2011, 11:05:09 PM
For that to happen, ties would need to be quite common. Other than that you've the tie bet. This game doesn't give the house a quite good edge as blackjack does, it's true, as odds are roughly 46,3% to both sides.
Still, the amounts in play may make you sure that you'll always come out with your watch, wallet and shoes.

Do you take a commission on won ties?  I bet 10 BTC in play money, tied, won, then got 19.90BTC back.

Yeah, I've been playing about 10 min, and he takes 1% of the initial wager (not the 2x wager, just the initial 1x wager) any time you go to war, win or lose.  Still, that doesn't come close to overcoming player winning ties.  (I'm going to play a bit longer to confirm that players DO in fact win ties, and then I might deposit.  After that, I might quit my job.)


Title: Re: Introducing Cardwars
Post by: tomcollins on May 22, 2011, 11:06:08 PM
For that to happen, ties would need to be quite common. Other than that you've the tie bet. This game doesn't give the house a quite good edge as blackjack does, it's true, as odds are roughly 46,3% to both sides.
Still, the amounts in play may make you sure that you'll always come out with your watch, wallet and shoes.

Do you take a commission on won ties?  I bet 10 BTC in play money, tied, won, then got 19.90BTC back.

Yeah, I've been playing about 10 min, and he takes 1% of the initial wager (not the 2x wager, just the initial 1x wager) any time you go to war, win or lose.  Still, that doesn't come close to overcoming player winning ties.  (I'm going to play a bit longer to confirm that players DO in fact win ties, and then I might deposit.  After that, I might quit my job.)

Either I'm running really bad or there is severe riggage.


Title: Re: Introducing Cardwars
Post by: BCEmporium on May 22, 2011, 11:06:41 PM
Do you take a commission on won ties?  I bet 10 BTC in play money, tied, won, then got 19.90BTC back.

Nope, let me check what went with it.
Can you confirm it was only the flash GUI that did it (ie if your balance updated 19.90 or 20)? I'm playing now to try to get to it, but so far no war.



Title: Re: Introducing Cardwars
Post by: luv2drnkbr on May 22, 2011, 11:08:19 PM
Do you take a commission on won ties?  I bet 10 BTC in play money, tied, won, then got 19.90BTC back.

Nope, let me check what went with it.
Can you confirm it was only the flash GUI that did it (ie if your balance updated 19.90 or 20)? I'm playing now to try to get to it, but so far no war.



LOL ya no you totally take 1% on all wars win or lose.


Title: Re: Introducing Cardwars
Post by: tomcollins on May 22, 2011, 11:14:16 PM
I'm not saying this is intentionally a scam, but there is no mathematical way I could have run as badly as I did.  Something is rigged in this casino, either by design or by carelessness.  Buyer beware.


Title: Re: Introducing Cardwars
Post by: luv2drnkbr on May 22, 2011, 11:17:02 PM
I'm not saying this is intentionally a scam, but there is no mathematical way I could have run as badly as I did.  Something is rigged in this casino, either by design or by carelessness.  Buyer beware.

This is blatantly not true.  Tom, you're a poker player, you know better.  For shame.  Still, if BCEmporium wanted to release some source code, that would be nice.


Title: Re: Introducing Cardwars
Post by: BCEmporium on May 22, 2011, 11:17:46 PM
Still can't find where is that 1% going:

Here's the "war" code:

Code:
<?php
      
function war(){
          global 
$bank,$Player;
           
$this->output[] = '<component err_code="0" game_session="'.$this->game_id.'" name="Cardwars" response="war">';          
           
$ucard $this->deck[$this->pointer];
           
$this->pointer++;
           
$dcard $this->deck[$this->pointer];
           
$this->pointer++;

           
$dcardVal $this->getCardValue($dcard);
           
$ucardVal $this->getCardValue($ucard); 

          if(
$dcardVal $ucardVal){
               
$bank->method "update";
               
$this->betLines[] = '<bet name="ante" staked="'.$this->bet.'" won="0" />';
               
$this->betLines[] = '<bet name="bet" staked="'.$this->bet.'" won="0" />';
               if(
$this->tie 0){
                      
$tieWon = ($this->tie 10) + $this->tie;
                    
$this->betLines[] = '<bet name="tie" staked="'.$this->tie.'" won="'.$tieWon.'" />';
                  
$bank->addBalanceLineX($tieWon);
                  
$bank->payPrize($tieWon/100);
                  if(
$bank->play == "r"){
                        
$Player->updateReal($tieWon/100);
                  }else{
                        
$Player->updateFree($tieWon/100);
                  }                    
                                
               }else{
                   
$bank->addBalanceLineX(-$this->bet);
                   
$this->betLines[] = '<bet name="tie" staked="0" won="0" />';
               }
               
$this->output[] = '<result player="'.$ucard.'" dealer="'.$dcard.'" state="loss" />';
          }else{
               
$bank->method "update";
               
$betWin $this->bet 2;
               
$this->betLines[] = '<bet name="ante" staked="'.$this->bet.'" won="'.$betWin.'" />';
               
$this->betLines[] = '<bet name="bet" staked="'.$this->bet.'" won="'.$betWin.'" />';
               
$bank->payPrize(($betWin 2)/100);
               if(
$bank->play == "r"){
                   
$Player->updateReal(($betWin 2)/100);
               }else{
                   
$Player->updateFree(($betWin 2)/100);
               }
               if(
$this->tie 0){          
                       
$tieWon = ($this->tie 10) + $this->tie;
                    
$this->betLines[] = '<bet name="tie" staked="'.$this->tie.'" won="'.$tieWon.'" />';
                  
$bank->addBalanceLineX($tieWon);
                  
$bank->payPrize($tieWon/100);
                  if(
$bank->play == "r"){
                        
$Player->updateReal($tieWon/100);
                  }else{
                        
$Player->updateFree($tieWon/100);
                  }  
               }else{
                   
$bank->addBalanceLineX($this->bet 2);
                   
$bank->addBalanceLineX($this->bet 2);
                   
$this->betLines[] = '<bet name="tie" staked="0" won="0" />';
               }
               
$this->output[] = '<result player="'.$ucard.'" dealer="'.$dcard.'" state="win" />';             
          }
    }
?>


What happened tomcollins?


Title: Re: Introducing Cardwars
Post by: BCEmporium on May 22, 2011, 11:22:00 PM
Holy s....!!!
You guys don't waste time!  ???
I decided to take cardwars out while re-checking its engine.


Title: Re: Introducing Cardwars
Post by: tomcollins on May 22, 2011, 11:22:25 PM
Still can't find where is that 1% going:

Here's the "war" code:

Code:
<?php
      
function war(){
          global 
$bank,$Player;
           
$this->output[] = '<component err_code="0" game_session="'.$this->game_id.'" name="Cardwars" response="war">';          
           
$ucard $this->deck[$this->pointer];
           
$this->pointer++;
           
$dcard $this->deck[$this->pointer];
           
$this->pointer++;

           
$dcardVal $this->getCardValue($dcard);
           
$ucardVal $this->getCardValue($ucard); 

          if(
$dcardVal $ucardVal){
               
$bank->method "update";
               
$this->betLines[] = '<bet name="ante" staked="'.$this->bet.'" won="0" />';
               
$this->betLines[] = '<bet name="bet" staked="'.$this->bet.'" won="0" />';
               if(
$this->tie 0){
                      
$tieWon = ($this->tie 10) + $this->tie;
                    
$this->betLines[] = '<bet name="tie" staked="'.$this->tie.'" won="'.$tieWon.'" />';
                  
$bank->addBalanceLineX($tieWon);
                  
$bank->payPrize($tieWon/100);
                  if(
$bank->play == "r"){
                        
$Player->updateReal($tieWon/100);
                  }else{
                        
$Player->updateFree($tieWon/100);
                  }                    
                                
               }else{
                   
$bank->addBalanceLineX(-$this->bet);
                   
$this->betLines[] = '<bet name="tie" staked="0" won="0" />';
               }
               
$this->output[] = '<result player="'.$ucard.'" dealer="'.$dcard.'" state="loss" />';
          }else{
               
$bank->method "update";
               
$betWin $this->bet 2;
               
$this->betLines[] = '<bet name="ante" staked="'.$this->bet.'" won="'.$betWin.'" />';
               
$this->betLines[] = '<bet name="bet" staked="'.$this->bet.'" won="'.$betWin.'" />';
               
$bank->payPrize(($betWin 2)/100);
               if(
$bank->play == "r"){
                   
$Player->updateReal(($betWin 2)/100);
               }else{
                   
$Player->updateFree(($betWin 2)/100);
               }
               if(
$this->tie 0){          
                       
$tieWon = ($this->tie 10) + $this->tie;
                    
$this->betLines[] = '<bet name="tie" staked="'.$this->tie.'" won="'.$tieWon.'" />';
                  
$bank->addBalanceLineX($tieWon);
                  
$bank->payPrize($tieWon/100);
                  if(
$bank->play == "r"){
                        
$Player->updateReal($tieWon/100);
                  }else{
                        
$Player->updateFree($tieWon/100);
                  }  
               }else{
                   
$bank->addBalanceLineX($this->bet 2);
                   
$bank->addBalanceLineX($this->bet 2);
                   
$this->betLines[] = '<bet name="tie" staked="0" won="0" />';
               }
               
$this->output[] = '<result player="'.$ucard.'" dealer="'.$dcard.'" state="win" />';             
          }
    }
?>


What happened tomcollins?

In a fair game, I win my bet 47%, lose my bet 47%, win 199% of my bet 3.2%, lose 201% 2.8%.  I started playing for 1 BTC per hand.  Getting down 10 BTC in a short period of time is fairly hard to do.  I'll need to run the simulations on it.  So I switched to lower bets, same thing kept happening, I would lose far more often than you would expect.  I didn't record results, but getting down 10 bets with the first amount, then getting down about 10-15 bets again is very, very unlikely if it were a fair game.

I doubt you are scamming us, but something is not kosher with the way the cards are being dealt.  I'll see if I can figure out what it is, if that's the source.  I'll find the 99% thing too.


Title: Re: Introducing Cardwars
Post by: luv2drnkbr on May 22, 2011, 11:29:17 PM
Holy s....!!!
You guys don't waste time!  ???
I decided to take cardwars out while re-checking its engine.

Oh gay I was just about to deposit.  Why'd you take it offline?  Was Tom right and he was being cheated (by accident of course!) or did you discover the 2x payment and 1% commision glitches..???


Title: Re: Introducing Cardwars
Post by: tomcollins on May 22, 2011, 11:30:37 PM
This is real odd, playing for play money, and the opposite is happening, I can't stop losing.  I need to run a simulation to see what are the odds someone is behind by 10 bets within 1000 plays or something.  Perhaps I am just unlucky at real money and super lucky at real!


Title: Re: Introducing Cardwars
Post by: BCEmporium on May 22, 2011, 11:35:42 PM
I'm trying to figure out that 1% and all that statistical math. Back to test bench, to burn that game again.
tomcollins, as far as I can see you're up 48 fun

Edit: checked the db again, now you're about 5 down of the initial 100 fun


Title: Re: Introducing Cardwars
Post by: tomcollins on May 22, 2011, 11:44:45 PM
I was up a lot, lost a lot since then.

The problem may be that it doesn't pay enough when you win on wars.  That might account for it.  It's annoying because I need to get a war then win to see if it's right, plus I need to remember what my balance was before the bet.

If that's the case, then my losses is pretty much expectations, but that doesn't seem like that's what it's supposed to be paying me.

For example, I bet $10.  I get a tie, so I go to war, bet another $10.  I should get $39.90 back ($19.90 profit) if I win the war, and bet out my $20.10 if I lose the war.  But what may be happening is I win back only get back $29.90 (my $20 bet plus $10 on the war bet).

Actually, that is how Casino War works in the Casino now that I looked it up.  This is a brutal game for the player even with the tie going to the player (the commission fixes that).

Arg, I think that makes sense at least.  Not quite the rules I was expecting (it's not really well defined).  House edge is gigantic.


Title: Re: Introducing Cardwars
Post by: tomcollins on May 22, 2011, 11:47:01 PM
Just hit a war, won, and got paid what I would have expected ($40-commission) in play money.  Really weird.

If you have logs of the hands, that would be super sweet to look at.  I'd like to get to the bottom of this.  I trust you aren't trying to scam anyone, and either it's a misunderstanding of the rules or a bug somewhere.


Title: Re: Introducing Cardwars
Post by: luv2drnkbr on May 22, 2011, 11:50:05 PM
This is real odd, playing for play money, and the opposite is happening, I can't stop losing.  I need to run a simulation to see what are the odds someone is behind by 10 bets within 1000 plays or something.  Perhaps I am just unlucky at real money and super lucky at real!

Are you joking!?  10 unit swings are insanely common in 50/50 games.


Title: Re: Introducing Cardwars
Post by: BCEmporium on May 22, 2011, 11:50:26 PM
As I watched on the database:

From the initial 100 FBTC:

tomcollins: +7%, had been down to -5% at least
luv2drnkbr: +160%

This all in fun play, same algorithm, "just eyes" didn't touch anything.

Yes, tom, this game wages well the player during the wars, but before the player get a war he may lost a lot.
Also, by the looks of the DB, and assuming luv2 would make the same entrance you did I must say I'd been *F* lucky... as your luck seams to be down either for real or play, while his doesn't.

Still I'll "sleep over it" to decide whether to put this on or not. It's almost 1 AM here and I want to run more statistical analysis on it along with find that annoying 1% "commission".


Title: Re: Introducing Cardwars
Post by: luv2drnkbr on May 22, 2011, 11:55:07 PM
As I watched on the database:

From the initial 100 FBTC:

tomcollins: +7%, had been down to -5% at least
luv2drnkbr: +160%

This all in fun play, same algorithm, "just eyes" didn't touch anything.

Yes, tom, this game wages well the player during the wars, but before the player get a war he may lost a lot.
Also, by the looks of the DB, and assuming luv2 would make the same entrance you did I must say I'd been *F* lucky... as your luck seams to be down either for real or play, while his doesn't.

Still I'll "sleep over it" to decide whether to put this on or not. It's almost 1 AM here and I want to run more statistical analysis on it along with find that annoying 1% "commission".

I was betting 10 FBTC though, so that represents only a 16 unit upswing.  Please please put the game back in as it was, I'll be your bestest friend forever and ever.   :D


Title: Re: Introducing Cardwars
Post by: tomcollins on May 22, 2011, 11:55:45 PM
As I watched on the database:

From the initial 100 FBTC:

tomcollins: +7%, had been down to -5% at least
luv2drnkbr: +160%

This all in fun play, same algorithm, "just eyes" didn't touch anything.

Yes, tom, this game wages well the player during the wars, but before the player get a war he may lost a lot.
Also, by the looks of the DB, and assuming luv2 would make the same entrance you did I must say I'd been *F* lucky... as your luck seams to be down either for real or play, while his doesn't.

Still I'll "sleep over it" to decide whether to put this on or not. It's almost 1 AM here and I want to run more statistical analysis on it along with find that annoying 1% "commission".

Ok, seeing something weird on play money.  I play on fast mode so it's harder to see what's going on.  I got a tie.  Was betting 10BTC.  I went to war, and my balance as only .10 less afterward. I would have expected it to drop by 10BTC again.

I'm up 200% on play money now, played a TON of hands, though.  It's possible I'm just unlucky, but something seems off.  The code you put up is missing a few pieces so I'm not quite sure how it works.

dcard is dealer card?  

Get some sleep, we'll get to the bottom of it tomorrow.  Thanks for looking into it.


Title: Re: Introducing Cardwars
Post by: tomcollins on May 22, 2011, 11:58:04 PM
As I watched on the database:

From the initial 100 FBTC:

tomcollins: +7%, had been down to -5% at least
luv2drnkbr: +160%

This all in fun play, same algorithm, "just eyes" didn't touch anything.

Yes, tom, this game wages well the player during the wars, but before the player get a war he may lost a lot.
Also, by the looks of the DB, and assuming luv2 would make the same entrance you did I must say I'd been *F* lucky... as your luck seams to be down either for real or play, while his doesn't.

Still I'll "sleep over it" to decide whether to put this on or not. It's almost 1 AM here and I want to run more statistical analysis on it along with find that annoying 1% "commission".

I was betting 10 FBTC though, so that represents only a 16 unit upswing.  Please please put the game back in as it was, I'll be your bestest friend forever and ever.   :D

16 unit upswing is absolutely huge in this game.  It's almost like we are playing as the dealer for play money, and player for real money.  If the codepath is different for real vs. play, that might explain it.  Something is not right.  I think for play money, we are paying only half as much as we should on tie-loss, but with real money, it's the opposite (pay full amount for tie-loss, get half the payout for tie-win).  The numbers seem to match up perfectly.

Hopefully it's a bug and BCE finds it tomorrow.  I'd greatly appreciate knowing what happened.


Title: Re: Introducing Cardwars
Post by: luv2drnkbr on May 23, 2011, 12:02:32 AM
Just hit a war, won, and got paid what I would have expected ($40-commission) in play money.  Really weird.

If you have logs of the hands, that would be super sweet to look at.  I'd like to get to the bottom of this.  I trust you aren't trying to scam anyone, and either it's a misunderstanding of the rules or a bug somewhere.

I was paying attention to my balance and I'm fairly sure (although not 100%) that I got paid the full amount, eg 39.90


Title: Re: Introducing Cardwars
Post by: luv2drnkbr on May 23, 2011, 12:04:07 AM
This is real odd, playing for play money, and the opposite is happening, I can't stop losing.  I need to run a simulation to see what are the odds someone is behind by 10 bets within 1000 plays or something.  Perhaps I am just unlucky at real money and super lucky at real!

A 95% confidence at 1000 trials of a 50/50 game is plus or minus 32 units.  As I keep telling you, 10 unit swings are common.


Title: Re: Introducing Cardwars
Post by: tomcollins on May 23, 2011, 12:07:21 AM
Just hit a war, won, and got paid what I would have expected ($40-commission) in play money.  Really weird.

If you have logs of the hands, that would be super sweet to look at.  I'd like to get to the bottom of this.  I trust you aren't trying to scam anyone, and either it's a misunderstanding of the rules or a bug somewhere.

I was paying attention to my balance and I'm fairly sure (although not 100%) that I got paid the full amount, eg 39.90

You were playing play money?  I was noticing full payout on play money.  I wasn't paying close enough attention at real money to know.  I think at play-money, he wasn't charging enough on ties when you lose (you have to double your bet).  If the opposite problem exists at real (I have to speculate since I can't test it anymore), everything makes perfect sense.  I don't understand a lot of the external parts of the code for what he posted (it didn't even seem to really have the option for users to surrender or not, so I don't see where that code is), so there's no way to verify it.

I'm pretty sure that's the problem.  Hopefully he can get that part of the code or investigate it (I'd be happy to test on a different account with house money that I couldn't cash out if I won) to try to identify the problem.

It's always possible I ran 10 standard deviations below normal over my few hundred hands, but based on the play money problem I think I found, a bug seems more likely.


Title: Re: Introducing Cardwars
Post by: tomcollins on May 23, 2011, 12:09:27 AM
This is real odd, playing for play money, and the opposite is happening, I can't stop losing.  I need to run a simulation to see what are the odds someone is behind by 10 bets within 1000 plays or something.  Perhaps I am just unlucky at real money and super lucky at real!

A 95% confidence at 1000 trials of a 50/50 game is plus or minus 32 units.  As I keep telling you, 10 unit swings are common.

10 units, then 20 (smaller) units after that?  Based on the bug I already found?  Sure, it's possible.  I wasn't at 1000 trials, no way.  If I played more than 200 hands I'd be surprised.

You have an easy way to calculate the probability?  I'll write a program real quick to test it out based on the actual probabilities of what the game should have been.


Title: Re: Introducing Cardwars
Post by: tomcollins on May 23, 2011, 12:11:49 AM
Ok, looks like the rule *should* be this:

If the player elects to go to war he must raise his bet by an amount equal to his original wager. The dealer will do the same but this is just for show. The dealer will then burn three cards and give the player and dealer another card each. If the player's second card equals or beats the dealer then the player shall win even money on the raise only and the original wager shall push. If the dealer's second card is greater the player shall lose both bets.

It definitely wasn't doing that for play money.  Could have been intentional or not.  I was getting double the payout.  I know I wasn't losing anything extra on the 2nd bet.  That could be where the "commission" was coming from, the 2nd bet was 1/100 of what it was.  I see a lot of bet/100 code, so perhaps that's what's happening on the 2nd bet.


Title: Re: Introducing Cardwars
Post by: BCEmporium on May 23, 2011, 12:14:59 AM
Here's the whole class code, I just keep browsing it up and down and still can't find what went wrong:

Code:
<?php
  
class Cardwars{
  
    var 
$game_id;
    var 
$bet 0;
    var 
$tie 0;
    var 
$warbet 0;
    var 
$pointer 0;
    var 
$output = array();
    var 
$deck = array();
    var 
$betLines = array();
      
    function 
Cardwars($game){
        
$this->game_id $game['id'];
        
$this->deck explode(",",$game['baralho']);
        
$this->bet $game['bet'];
        
$this->tie $game['tie'];
        
$this->pointer $game['ponteiro'];
    }
  
      function 
init_game(){
        
$this->resetVars();  
        
$this->output[] = "<component err_code=\"0\" game_session=\"".$this->game_id."\" name=\"Cardwars\" response=\"init\">";
        
$this->output[] = "<result chip_values=\"10,50,100,250,1000\" default_chip=\"1\" stake_max=\"1000\" stake_min=\"10\" />";    
        
$this->output[] = "</component>";
      }  
      
      
      function 
getComponentOutput(){
          global 
$x;
          
$x->addComponent(implode("\r\n",$this->output));
      }      
      
      
     function 
resetVars(){
         
$sql "UPDATE cardwars SET baralho='',ponteiro=0 WHERE id = " $this->game_id;
         
mysql_query($sql);
     }
     
     
      function 
start_deck(){
          
$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); 
          
$this->deck $baralho;
          
$this->pointer 0;
          
mysql_query("UPDATE cardwars SET baralho = '".implode(",",$baralho)."', bet=0,tie=0,ponteiro=0 WHERE id = " $this->game_id);         
      }           
      
      
        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;  
        }       
      
      function 
deal(){
          global 
$bank,$Player;
           
$this->output[] = '<component err_code="0" game_session="'.$this->game_id.'" name="Cardwars" response="deal">';
           
           if(
$this->bet 0){
               
mysql_query("UPDATE cardwars SET bet = "$this->bet" WHERE id =" $this->game_id);
           }
           if(
$this->tie 0){
               
mysql_query("UPDATE cardwars SET tie = "$this->tie" WHERE id =" $this->game_id);
           }           
           
$ucard $this->deck[$this->pointer];
           
$this->pointer++;
           
$dcard $this->deck[$this->pointer];
           
$this->pointer++;               

           
$dcardVal $this->getCardValue($dcard);
           
$ucardVal $this->getCardValue($ucard);

           
$this->updatePointer();
           if(
$dcardVal $ucardVal){
               
$bank->method "update";
               
$this->betLines[] = '<bet name="ante" staked="'.$this->bet.'" won="0" />';
               if(
$this->tie 0){
                    
$this->betLines[] = '<bet name="tie" staked="'.$this->tie.'" won="0" />';
                    
$bt $this->tie $this->bet;
                    
$bank->addBalanceLineX(-$bt);
               }else{
                   
$bank->addBalanceLineX(-$this->bet);
                   
$this->betLines[] = '<bet name="tie" staked="0" won="0" />';
               }
               
$this->output[] = '<result player="'.$ucard.'" dealer="'.$dcard.'" state="loss" />';
               
$this->resetVars();
           }elseif(
$dcardVal $ucardVal){
               
$bank->method "update";
               
$betWin $this->bet 2;
               
$this->betLines[] = '<bet name="ante" staked="'.$this->bet.'" won="'.$betWin.'" />';
               
$bank->payPrize($betWin/100);
               if(
$bank->play == "r"){
                   
$Player->updateReal($betWin/100);
               }else{
                   
$Player->updateFree($betWin/100);
               }
               if(
$this->tie 0){          
                    
$this->betLines[] = '<bet name="tie" staked="'.$this->tie.'" won="0" />';
                    
$bt $this->tie $this->bet;
                    
$bank->addBalanceLineX(-$this->tie);
               }else{
                   
$bank->addBalanceLineX($this->bet);
                   
$this->betLines[] = '<bet name="tie" staked="0" won="0" />';
               }
               
$this->output[] = '<result player="'.$ucard.'" dealer="'.$dcard.'" state="win" />';
               
$this->resetVars();               
           }elseif(
$dcardVal == $ucardVal){
              
$bank->method "update";
              
$this->betLines[] = '<bet name="ante" staked="'.$this->bet.'" won="0" />';
               if(
$this->tie 0){
                    
$this->betLines[] = '<bet name="tie" staked="'.$this->tie.'" won="0" />';
                    
$bt $this->tie $this->bet;
                    
$bank->addBalanceLineX(-$bt);                  
               }else{
                   
$bank->addBalanceLineX(-$this->bet);
                   
$this->betLines[] = '<bet name="tie" staked="0" won="0" />';
               }
               
$this->output[] = '<result player="'.$ucard.'" dealer="'.$dcard.'" state="tie" />';              
               
           }
           
           if(!empty(
$this->betLines)) $this->output[] = implode("\r\n",$this->betLines);
           
$this->output[] = "</component>";
      }
      
      
      function 
surrender(){
          global 
$bank,$Player;
          
$bank->method "update";
          
$this->output[] = '<component err_code="0" game_session="'.$this->game_id.'" name="Cardwars" response="surrender">';
          
$this->output[] = '<result player="" dealer="" state="" />';
          
$bwon $this->bet /2;
          
$this->betLines[] = '<bet name="ante" stake="'.$bwon.'" won="'.$bwon.'" />';
          
$this->betLines[] = '<bet name="back" stake="'.$bwon.'" won="0" />';
          
$bank->addBalanceLineX($bwon);
          
$bank->payPrize($bwon/100);
          if(
$bank->play == "r"){
                
$Player->updateReal($bwon/100);
          }else{
                
$Player->updateFree($bwon/100);
          }
          if(
$this->tie 0){
                   
$tieWon = ($this->tie 10) + $this->tie;
                    
$this->betLines[] = '<bet name="tie" staked="'.$this->tie.'" won="'.$tieWon.'" />';
                  
$bank->addBalanceLineX($tieWon);
                  
$bank->payPrize($tieWon/100);
                  if(
$bank->play == "r"){
                        
$Player->updateReal($tieWon/100);
                  }else{
                        
$Player->updateFree($tieWon/100);
                  }                    
                                  
          }else{
              
$this->betLines[] = '<bet name="tie" staked="0" won="0" />';              
          }
           if(!empty(
$this->betLines)) $this->output[] = implode("\r\n",$this->betLines);
           
$this->output[] = "</component>";
           
$this->resetVars();                    
      }
      
      
      function 
war(){
          global 
$bank,$Player;
           
$this->output[] = '<component err_code="0" game_session="'.$this->game_id.'" name="Cardwars" response="war">';          
          
           
$ucard $this->deck[$this->pointer];
           
$this->pointer++;
           
$dcard $this->deck[$this->pointer];
           
$this->pointer++;               

           
$dcardVal $this->getCardValue($dcard);
           
$ucardVal $this->getCardValue($ucard);          
          
           
$this->updatePointer();
          if(
$dcardVal $ucardVal){
               
$bank->method "update";
               
$this->betLines[] = '<bet name="ante" staked="'.$this->bet.'" won="0" />';
               
$this->betLines[] = '<bet name="bet" staked="'.$this->bet.'" won="0" />';
               if(
$this->tie 0){
                      
$tieWon = ($this->tie 10) + $this->tie;
                    
$this->betLines[] = '<bet name="tie" staked="'.$this->tie.'" won="'.$tieWon.'" />';
                  
$bank->addBalanceLineX($tieWon);
                  
$bank->payPrize($tieWon/100);
                  if(
$bank->play == "r"){
                        
$Player->updateReal($tieWon/100);
                  }else{
                        
$Player->updateFree($tieWon/100);
                  }                    
                                
               }else{
                   
$bank->addBalanceLineX(-$this->bet);
                   
$this->betLines[] = '<bet name="tie" staked="0" won="0" />';
               }
               
$this->output[] = '<result player="'.$ucard.'" dealer="'.$dcard.'" state="loss" />';
          }else{
               
$bank->method "update";
               
$betWin $this->bet 2;
               
$this->betLines[] = '<bet name="ante" staked="'.$this->bet.'" won="'.$betWin.'" />';
               
$this->betLines[] = '<bet name="bet" staked="'.$this->bet.'" won="'.$betWin.'" />';
               
$bank->payPrize(($betWin 2)/100);
               if(
$bank->play == "r"){
                   
$Player->updateReal(($betWin 2)/100);
               }else{
                   
$Player->updateFree(($betWin 2)/100);
               }
               if(
$this->tie 0){          
                       
$tieWon = ($this->tie 10) + $this->tie;
                    
$this->betLines[] = '<bet name="tie" staked="'.$this->tie.'" won="'.$tieWon.'" />';
                  
$bank->addBalanceLineX($tieWon);
                  
$bank->payPrize($tieWon/100);
                  if(
$bank->play == "r"){
                        
$Player->updateReal($tieWon/100);
                  }else{
                        
$Player->updateFree($tieWon/100);
                  }  
               }else{
                   
$bank->addBalanceLineX($this->bet 2);
                   
$bank->addBalanceLineX($this->bet 2);
                   
$this->betLines[] = '<bet name="tie" staked="0" won="0" />';
               }
               
$this->output[] = '<result player="'.$ucard.'" dealer="'.$dcard.'" state="win" />';             
          }
          
           if(!empty(
$this->betLines)) $this->output[] = implode("\r\n",$this->betLines);
           
$this->output[] = "</component>";
           
$this->resetVars();           
      }
      function 
updatePointer(){
          
mysql_query("UPDATE cardwars SET ponteiro = {$this->pointer} WHERE id = " $this->game_id);
      }      
  }
?>



dcard = Dealer Card
ucard = Player Card
1/100 is because the values are passed into the game as int, so instead of 2.00 it passes 200.


Title: Re: Introducing Cardwars
Post by: BCEmporium on May 23, 2011, 12:29:19 AM
Well... just figured it was double paying on ties and was double 1/100.
This second bug actually covered up the double paying and added that 1% "commission".

initial bug is here:

         case 'war':
                   $warbet = $cardwars->bet/100;
                    $realbet = $warbet/100;

The switch that calls the functions.
Second bug is in that class.
bug 1 + bug 2 = 1% commission on war ties


Title: Re: Introducing Cardwars
Post by: tomcollins on May 23, 2011, 12:32:13 AM
Well... just figured it was double paying on ties and was double 1/100.
This second bug actually covered up the double paying and added that 1% "commission".

initial bug is here:

         case 'war':
                   $warbet = $cardwars->bet/100;
                    $realbet = $warbet/100;

The switch that calls the functions.
Second bug is in that class.
bug 1 + bug 2 = 1% commission on war ties

This is code you didn't post already, right?

Is it doing something different for real vs. fake money?

I really appreciate you looking at this!


Title: Re: Introducing Cardwars
Post by: BCEmporium on May 23, 2011, 12:39:29 AM
Nope, it just calls the same functions, the only difference is in those lines:

if($bank->play == "r"{
goes to real
}else{
goes to play
}

Code:
<?php
    
require_once("api_engine/classes/cardwars.php");       
    
$cardwars = new Cardwars($r);
    
  switch(
strtolower($do)){
        case 
'init':
                    
$bank->setGeneralRealBalance();
                    
$bank->getComponentOutPut();
                    
$cardwars->init_game();
                    
$cardwars->getComponentOutput();
                    
$x->doOutput();
                    break; 
        case 
'deal':
                    
$totalbet 0;
                    
                    foreach(
$xml->component->bet as $c){
                        
$totalbet += $c->attributes()->stake;
                        switch(
$c->attributes()->name){
                            case 
'ante'$cardwars->bet $c->attributes()->stake;break;
                            case 
'tie'$cardwars->tie $c->attributes()->stake;break;
                        }
                    }    
                    
                    
$realbet $totalbet/100;
                    if(
$bank->play == "r"){       
                        if(
$totalbet/100 $Player->real){
                            echo 
"<error>Insufficient funds!</error>";                               
                            die();                                                 
                        }
                        
$Player->updateReal(-$realbet);
                    }else{
                        if(
$totalbet/100 $Player->free){
                            echo 
"<error>Insufficient funds!</error>";                                         
                            die();                                                 
                        }                        
                        
$Player->updateFree(-$realbet);
                    }
                    
                    
$cardwars->start_deck();
                    
$cardwars->deal();                    
                    
$bank->setGeneralRealBalance();
                    
$bank->getComponentOutPut();                    
                    
$cardwars->getComponentOutput();
                    
$x->doOutput();                        
                    break;
                    
         case 
'surrender':
                    
$cardwars->surrender();
                    
$bank->setGeneralRealBalance();
                    
$bank->getComponentOutPut();                    
                    
$cardwars->getComponentOutput();
                    
$x->doOutput();                            
                    break; 
         case 
'war':
                   
$warbet $cardwars->bet//Fixed here the double 1/100
                    
$realbet $warbet/100;
                    if(
$bank->play == "r"){       
                        if(
$warbet/100 $Player->real){
                            echo 
"<error>Insufficient funds!</error>";                               
                            die();                                                 
                        }
                        
$Player->updateReal(-$realbet);
                    }else{
                        if(
$totalbet/100 $Player->free){
                            echo 
"<error>Insufficient funds!</error>";                                         
                            die();                                                 
                        }                        
                        
$Player->updateFree(-$realbet);
                    }    
                    
                    
$cardwars->warbet $cardwars->bet;
                    
$cardwars->war();
                    
$bank->setGeneralRealBalance();
                    
$bank->getComponentOutPut();                    
                    
$cardwars->getComponentOutput();
                    
$x->doOutput();                           
                    break;
  }    
?>
 


EDIT: I will go to sleep now. House edge ranges 1,71 ~ 2,88%, I didn't thought much of it because my initial draft for these casinos were to play for pennies, meanwhile btc raised "a bit". I probably will fix and put it back but just in mBTCasino with lower limits; therefore even if I get unlucky with the player on the table, the losses are easily covered.


Title: Re: Introducing Cardwars
Post by: tomcollins on May 23, 2011, 12:54:29 AM
If I was getting undercharged on war bets and given the full payouts, I must be the most unlucky guy alive to lose that much!  I would have had a 3% edge, and was down 30 bets.  Maybe a .5% chance of it or worse, so it's always possible I am just unlucky!

Still trying to go through the code, some of it is a bit tricky to read.

If you want me to test using the actual game (I'd like to try in real money mode, but I would of course not keep any of the profit or losses since it would just be for testing), I'm open to it.


Title: Re: Introducing Cardwars
Post by: BCEmporium on May 23, 2011, 01:00:49 AM
If it helps you to understand what's going "behind the scenes", here's a line of server to client log (from test server):

<?xml version="1.0" encoding="UTF-8"?>
<response response_id="2"> <component name="Balance" response="update">
<generalBalance name="Cardwars" amount="-1000" />
<generalRealBalance amount="10000" />
</component> <component err_code="0" game_session="25" name="Cardwars" response="deal">
<result player="As" dealer="Qs" state="win" />
<bet name="ante" staked="1000" won="2000" />
<bet name="tie" staked="1000" won="0" />
</component></response>

Tomorrow after fixing it, I'll give you the address to test-net.
Still, the only difference between play and real is that button in the corner; at play it's blue and says play for real / in real it's green and says cashier.


Title: Re: Introducing Cardwars
Post by: tomcollins on May 23, 2011, 01:13:11 AM
If it helps you to understand what's going "behind the scenes", here's a line of server to client log (from test server):

<?xml version="1.0" encoding="UTF-8"?>
<response response_id="2"> <component name="Balance" response="update">
<generalBalance name="Cardwars" amount="-1000" />
<generalRealBalance amount="10000" />
</component> <component err_code="0" game_session="25" name="Cardwars" response="deal">
<result player="As" dealer="Qs" state="win" />
<bet name="ante" staked="1000" won="2000" />
<bet name="tie" staked="1000" won="0" />
</component></response>

Tomorrow after fixing it, I'll give you the address to test-net.
Still, the only difference between play and real is that button in the corner; at play it's blue and says play for real / in real it's green and says cashier.

The only difference is supposed to be that, of course, but there is some different code paths, so it's always possible for a bug.  I'd like to see the original code on test-net if possible just to pay close attention to the tie situations.  Thanks for looking into this, no rush on anything.


Title: Re: Introducing Cardwars
Post by: luv2drnkbr on May 23, 2011, 03:07:55 AM
I'm not sure whether to feel good or bad that we helped fixed the glitches.  I think that next time somebody posts a game with a double payment glitch, I'm going to keep my mouth shut and just play it until they realize the mistake themselves...  Making a few hundred bucks off a casino is something I think I can learn to not feel bad about.  ;)


Title: Re: Introducing Cardwars
Post by: tomcollins on May 23, 2011, 03:12:18 AM
I'm not sure whether to feel good or bad that we helped fixed the glitches.  I think that next time somebody posts a game with a double payment glitch, I'm going to keep my mouth shut and just play it until they realize the mistake themselves...  Making a few hundred bucks off a casino is something I think I can learn to not feel bad about.  ;)

I'm still not convinced that it was working properly for real money.  The edge we had was quite significant, getting down 30 bets is just so hard to pull off with that edge.  

Debugging source code without being to step through it or examine what its actually doing is tough, especially when you don't have all the code.

I'm hoping he has logs of what happened for real money.  I see code that looks like it's logging things, so I'd love to look at those.  There's always a chance the log is wrong, but it should shed some light on it.

I caught a huge bug in an online poker site.  They had a bug where a player could go all in for less than other players.  But if he won, he'd win the same amount everyone else bet.  For example, someone bets $3 (all he has).  The other players raise and stay in for $10 each.  So the total pot is $23.  If the hand plays properly, the low guy wins $9 if he actually wins, and the winner of the other two gets the other $14.  But they would give the low guy $30 out of a $23 pot.  I saw one case where the house actually lose >$1000 on one hand.  It was a crazy bug.  There wasn't a great way to take advantage of it since it didn't always happen.  Might as well report it for good karma.


Title: Re: Introducing Cardwars
Post by: BCEmporium on May 23, 2011, 12:52:57 PM
Gosh! Not my coding weekend as it seams.... woke up and found heavy losses at mbtcasino (luckily it was at mbtc), had to rush to put some coins from my wallet to cover it.  :(

I'll retract table card games, it attracts a kind of gambler I'm not quite comfortable with. While slots and lottery attracts relaxed players, table games attracts gamblers filled up with "get rich schemes" and all sorts of statistical rigs along. I would need a 24h/day surveillance system to see what's going on.

tom, late I'll put the cardwars test-net online.


Title: Re: Introducing Cardwars
Post by: tomcollins on May 23, 2011, 01:02:12 PM
Gosh! Not my coding weekend as it seams.... woke up and found heavy losses at mbtcasino (luckily it was at mbtc), had to rush to put some coins from my wallet to cover it.  :(

I'll retract table card games, it attracts a kind of gambler I'm not quite comfortable with. While slots and lottery attracts relaxed players, table games attracts gamblers filled up with "get rich schemes" and all sorts of statistical rigs along. I would need a 24h/day surveillance system to see what's going on.

tom, late I'll put the cardwars test-net online.

If you make a flaw in your payouts, someone will find it and exploit it.  The bug we found potentially saved you a ton of cash.  Even with the slots, if there's a mistake in the code, you can get burned hard.  However, it's more difficult for a user to find a slot that is paying out better than 100% (plus it's also easy to rig it toward the house).

Having a casino opens you up to a lot of losses even if it's done properly.  Hopefully you have it covered in case someone does get lucky.


Title: Re: Introducing Cardwars
Post by: BCEmporium on May 23, 2011, 01:14:09 PM
Even if I'm a "pioneer" and still have some dusty-BTC, I don't have a limitless supply of it.
Being alone also makes things hard, as I've to sleep from time to time leaving the casino on its own.

So far it adds to experience, so I can redo things better, log more... The logging system at testnet creates text files, so it's easy to follow, in that server it goes to db and due to a query error it was logging over the same line (means instead of sequential log I found out pretty few data about the last hand played).


Title: Re: Introducing Cardwars
Post by: tomcollins on May 23, 2011, 01:55:24 PM
Even if I'm a "pioneer" and still have some dusty-BTC, I don't have a limitless supply of it.
Being alone also makes things hard, as I've to sleep from time to time leaving the casino on its own.

So far it adds to experience, so I can redo things better, log more... The logging system at testnet creates text files, so it's easy to follow, in that server it goes to db and due to a query error it was logging over the same line (means instead of sequential log I found out pretty few data about the last hand played).

Even the big time casinos can be hit by this kind of stuff.  I've seen major sites have flaws in their shuffling algorithm that was exploitable and got hit for a ton of money.  But at the very least, calculate the expected odds on a game, then set up an automated test to play a million hands or so, and make sure you are very close to the expected value.  Doing that in this case should have caught the problem.

These types of games also can be very easily rigged to favor the house as well (not saying you did this, but others might).  So buyer beware on these types of things.  It's not very hard to rig a deck so that the player wins less than he should, but still wins close enough to the right amount that he doesn't notice.


Title: Re: Introducing Cardwars
Post by: BCEmporium on May 23, 2011, 02:20:13 PM
There wouldn't still be enough, playing 1 mil hands, by the theory of large numbers it would resemble a game tendency, however it would take a while until 1 million hands get played and that tendency shows of, meanwhile SD will call the shots and it may be to the house... or not.
Therefore on this kind of table games, I'll work towards online poker where the house takes its rake and players deal with each others. Not much to bother there, just keep an eye if the things go fine and if all-ins are well distributed.


Title: Re: Introducing Cardwars
Post by: tomcollins on May 23, 2011, 02:40:50 PM
There wouldn't still be enough, playing 1 mil hands, by the theory of large numbers it would resemble a game tendency, however it would take a while until 1 million hands get played and that tendency shows of, meanwhile SD will call the shots and it may be to the house... or not.
Therefore on this kind of table games, I'll work towards online poker where the house takes its rake and players deal with each others. Not much to bother there, just keep an eye if the things go fine and if all-ins are well distributed.

For the 1 million hands, you certainly could get a good idea that the game appears to be fair.  It shouldn't take that long to simulate (maybe a few hours at most).  If you are putting your money on the line in the house, it seems worth it.

Even then there are a lot of considerations.  You want to run a fair game.  There have been exploits in the past where you could predict what cards were coming due to an improper RNG.  Players can cheat and collude with each other.  There are potentially a lot of troubles.  There's a reason why the major poker sites all have multi-million dollar software budgets.

Best of luck!


Title: Re: Introducing Cardwars
Post by: BCEmporium on May 23, 2011, 03:09:07 PM
Players will always try to cheat, it's the role of the house to ensure they fail on the attempt.
With poker and low stakes, to not drag in those "cheating sharks", I believe I can put up a pleasant online poker. Players colluding is however a harder issue to deal (specially if they don't use the same IP Address), but that's something for other players in the table to see.

An issue to not need that mils budget is to not run mils tables. If stakes are too low to be "cheating profitable" they should keep their hands off (I believe).


Title: Re: Introducing Cardwars
Post by: tomcollins on May 23, 2011, 03:51:27 PM
Players will always try to cheat, it's the role of the house to ensure they fail on the attempt.
With poker and low stakes, to not drag in those "cheating sharks", I believe I can put up a pleasant online poker. Players colluding is however a harder issue to deal (specially if they don't use the same IP Address), but that's something for other players in the table to see.

An issue to not need that mils budget is to not run mils tables. If stakes are too low to be "cheating profitable" they should keep their hands off (I believe).

Cheaters gonna cheat.  I've played counter-strike for free and people cheat.  As long as you are monitoring things to make sure you aren't paying too much, players will have an interest in making sure they identify anything fishy, that should help out.

With a table game, no one is interested in protecting the house except the house and good Samaritans.  Players must also trust that they are getting a fair game, and with no 3rd party audits or checks, it's a matter of faith that the programmer did everything correctly and is not devious.

If there is anything else you need from me to help, I am willing to give it a look.


Title: Re: Introducing Cardwars
Post by: tomcollins on May 23, 2011, 07:14:38 PM
I want to thank BTEmporium for opening up his test server to me.

Based on what I have currently found, I think there may be a flaw in the shuffling algorithm used by php to shuffle arrays.  I need to investigate further and use a larger sample size, but there's a good chance that there is a flaw in it where certain cards are more likely to be in certain positions.

I'll run some tests tonight and report back.  I believe that BTEmporium is trying to run a fair game and is letting me help find any potential problems.

The payout problem with the current rules left a gigantic player advantage (6.8%), which means losing a lot of money over and over is very unlikely with a fair deck.  If there was anything that was not fair, it likely was not due to anything intentional by BTE, but by a flaw in php.  I'll update this thread with any findings I have.


Title: Re: Introducing Cardwars
Post by: luv2drnkbr on May 24, 2011, 06:52:24 AM
Yeah, with the numbers you PM'd me, it's getting up to just under 5 standard deviations, which is significant.  Also, BCEmporium, regarding collusion for online poker... There are many forms of cheating that you can and should worry about.  Collusion isn't one of them.  It's not possible to stop and therefore you shouldn't try.


Title: Re: Introducing Cardwars
Post by: eturnerx on May 24, 2011, 08:47:39 AM
Even if I'm a "pioneer" and still have some dusty-BTC, I don't have a limitless supply of it.
Being alone also makes things hard, as I've to sleep from time to time leaving the casino on its own.
Keep the stakes low on games until they've run long-enough that you're confident that your code is not exploitable. Place cash-out limits and/or cooldown times before winnings can be cashed out to give yourself time to investigate any large wins that look improbable. Even B&M casinos start watching players who seem to be winning too much. As they leave they'll have casino staff delay them while security reviews the table cameras for anything fishy. A common tactic is to make anybody cashing out above a certain amount to come to a private office - make them wait for the duty manager (who's in a meeting / other delay etc...)
Also consider bringing in help. It'll cost, but worth the peaceful sleep to ensure that the shuffle algorithm are good.


Title: Re: Introducing Cardwars
Post by: luv2drnkbr on May 24, 2011, 12:53:11 PM
Even if I'm a "pioneer" and still have some dusty-BTC, I don't have a limitless supply of it.
Being alone also makes things hard, as I've to sleep from time to time leaving the casino on its own.
Keep the stakes low on games until they've run long-enough that you're confident that your code is not exploitable. Place cash-out limits and/or cooldown times before winnings can be cashed out to give yourself time to investigate any large wins that look improbable. Even B&M casinos start watching players who seem to be winning too much. As they leave they'll have casino staff delay them while security reviews the table cameras for anything fishy. A common tactic is to make anybody cashing out above a certain amount to come to a private office - make them wait for the duty manager (who's in a meeting / other delay etc...)
Also consider bringing in help. It'll cost, but worth the peaceful sleep to ensure that the shuffle algorithm are good.

Except in casinos, you can still just walk out with the chips you've won.  Unless they have proof of a crime committed they can't hold you.  Then you can come back later and cash out the chips.  If you're a card counter and being hassled, you simply look the security guard (or suit or whoever is holding you) in the eye and ask them "Are you detaining me against my will?"  They'll let you go immediately.

As a business practice BCEmporium should always pay out player money.  If there's a flaw in his site, it's not the player's fault, not is the player cheating by merely playing a poorly programmed game.  Your idea about only allowing smaller bets on questionable games is a good idea, and I think that should be the way to handle the situation.  But not paying out because the game was flawed is unconscionable.


Title: Re: Introducing Cardwars
Post by: tomcollins on May 24, 2011, 01:17:33 PM
Yeah, with the numbers you PM'd me, it's getting up to just under 5 standard deviations, which is significant.  Also, BCEmporium, regarding collusion for online poker... There are many forms of cheating that you can and should worry about.  Collusion isn't one of them.  It's not possible to stop and therefore you shouldn't try.

I ran the numbers and it was 227,000:1 against what happened for 3 players to lose 15, 15, and 30 bets at that game with the incorrect payouts.  This means beyond any reasonable doubt, the game was rigged (likely unintentionally, but still not a fair game).

I'm hoping that BCE does the right thing and refunds my money for playing on a rigged game.  It would let the entire Bitcoin community know he is committed to running a fair game and if a problem is found, he is willing to come forward and repay players when there is a mistake.  It would speak very positively for his casino that as a pioneer, there will be bugs, but if they harm the player, the player will not be taken advantage of.


Title: Re: Introducing Cardwars
Post by: BCEmporium on May 24, 2011, 01:20:16 PM
You've full access to the source code, we both played with it and we both lost. I see no riggs there and even out of such "unlikeliness" the bugs were in favor of the player, not harming him.


Title: Re: Introducing Cardwars
Post by: tomcollins on May 24, 2011, 02:19:59 PM
You've full access to the source code, we both played with it and we both lost. I see no riggs there and even out of such "unlikeliness" the bugs were in favor of the player, not harming him.


227,000:1, but it's impossible that it's rigged.

The bugs we found *were* in favor of the player.  Quite severely.  Yet the player still lost in most simulations.  Not only lost, but lost a fairly large amount.  This makes it far more likely that an even bigger bug is still present and harming the player.

This is incredibly statistically significant proof that there is something not right in the game.  Just because you don't see it doesn't mean it doesn't exist.  There is a >99% chance of something incorrect going on harming the player, and <1% chance that we were just really unlucky.

Yet you are taking the stance that the <1% chance is much more likely.

I urge you to reconsider.


Title: Re: Introducing Cardwars
Post by: BCEmporium on May 24, 2011, 02:38:09 PM
Next to the .php you've the matching .phps, follow it and ran it over... the simulation I got on log.txt was playing with that code.
If you find something that was rigging the deck let me know, other than the deck rigged, if you were out of luck I don't see a reason to refund. And it's not just being stubborn, but if I start to refund each time a player goes down on luck I rather close all down now, as I'll attract all kinds of crooks to that casino «Cool! A casino where if you find the edge shifted and don't get away with it, you get a refund»... get real!

Also I must noticed that you saw a bug, told about it, and I thank you for that. The guy that found the bug on VP let me know nothing and when noticed I fixed the 4x double bug just cashed out and vanished. For that I may give you some credit still not understanding why you deposited and played while I was re-checking the code. Refund; if the deck ain't rigged: no way!


Title: Re: Introducing Cardwars
Post by: tomcollins on May 24, 2011, 02:59:51 PM
Next to the .php you've the matching .phps, follow it and ran it over... the simulation I got on log.txt was playing with that code.
If you find something that was rigging the deck let me know, other than the deck rigged, if you were out of luck I don't see a reason to refund. And it's not just being stubborn, but if I start to refund each time a player goes down on luck I rather close all down now, as I'll attract all kinds of crooks to that casino «Cool! A casino where if you find the edge shifted and don't get away with it, you get a refund»... get real!

Also I must noticed that you saw a bug, told about it, and I thank you for that. The guy that found the bug on VP let me know nothing and when noticed I fixed the 4x double bug just cashed out and vanished. For that I may give you some credit still not understanding why you deposited and played while I was re-checking the code. Refund; if the deck ain't rigged: no way!

How could I possibly prove that the deck was rigged?  Every piece of proof I've given (php shuffle bug, empirical evidence, etc...), you claim it isn't good enough.

I found a problem that rewarded the player too much, and I LET YOU KNOW IMMEDIATELY!  I am not trying to scam you.  I am not the guy who took advantage of your flawed logic.  Do not take it out on me.

You claim it is bad luck.  But be honest with yourself, it is much much more likely that the deck was unfairly shuffled (http://bugs.php.net/bug.php?id=18401) shows that it was broken.  This exact problem favors the house by giving the player lower cards than the house more often.
If you want to run a buggy casino that might be rigged, might not be, but there is no recourse, you will get very few players.  If someone finds an exploit, rather than telling you, they will play until you have no money left to pay out.  Especially when you treat your honest customers this way.  Your reputation is not worth it.  We are talking about 15BTC.  You offered a bet of 10BTC in the game, so it's less than two of those bets.  Did you even have money to cover a player winning (say I got as lucky as you re describing but was betting 10BTC each time, I would have been up 300 BTC, would you have paid out?)

I noticed that the test server now is running much different results.  Did you update PHP to include that bug fix?  Did something upgrade on there?  It is an impossible situation to prove at this point.  I can only look at likelihood that such a situation could have happened with a fair deck.  The odds are incredibly high (277,000:1).  You'll see on the test server, whatever changed since last night, the player wins almost all the time.  So did you upgrade it to fix the problem and then try to get me to shut up?  Because that's what it seems.  277,000:1 vs. buggy code (and you already have bugs everywhere, php had this bug before, so we know there is a high possibility of it).  Be realistic.


Title: Re: Introducing Cardwars
Post by: BCEmporium on May 24, 2011, 03:17:14 PM
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.


Title: Re: Introducing Cardwars
Post by: BCEmporium on May 24, 2011, 03:23:46 PM
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.


Title: Re: Introducing Cardwars
Post by: tomcollins on May 24, 2011, 03:34:28 PM
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)?


Title: Re: Introducing Cardwars
Post by: BCEmporium on May 24, 2011, 03:42:11 PM
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(...)


Title: Re: Introducing Cardwars
Post by: tomcollins on May 24, 2011, 03:48:48 PM
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.


Title: Re: Introducing Cardwars
Post by: BCEmporium on May 24, 2011, 07:07:44 PM
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"...


Title: Re: Introducing Cardwars
Post by: tomcollins on May 24, 2011, 08:16:16 PM
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.


Title: Re: Introducing Cardwars
Post by: BCEmporium on May 24, 2011, 08:24:55 PM
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.


Title: Re: Introducing Cardwars
Post by: BCEmporium on May 24, 2011, 08:32:55 PM
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.


Title: Re: Introducing Cardwars
Post by: tomcollins on May 24, 2011, 08:40:26 PM
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.


Title: Re: Introducing Cardwars
Post by: luv2drnkbr on May 25, 2011, 11:50:26 AM
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.


Title: Re: Introducing Cardwars
Post by: luv2drnkbr on May 25, 2011, 12:02:02 PM
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.


Title: Re: Introducing Cardwars
Post by: BCEmporium on May 25, 2011, 12:18:14 PM
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.


Title: Re: Introducing Cardwars
Post by: luv2drnkbr on May 26, 2011, 02:12:11 AM
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.


Title: Re: Introducing Cardwars
Post by: BCEmporium on May 26, 2011, 10:26:20 AM
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%»...


Title: Re: Introducing Cardwars
Post by: tomcollins on May 26, 2011, 08:04:15 PM
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).