|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
You eat, breathe and sleep innovation. Build your mobile intelligence with BlackBerry® experts this July. Register Today! |
|
#1
|
|||||
|
|||||
|
[Blackjack] Weird Money (Bug?)
Alright, so I'm calculating whether the last hand was won, lost, or pushed based on if my $result["money"] went up, down, or stayed the same from the last hand. Simple stuff.
I calculate whether it's a win or loss before I call MakeBet(), but it's OK because the hand is over and the money is correct. However, every once in a while (I can't distinguish a pattern) the money will change right after MakeBet(). Yes, I'm taking into account that I'm losing money betting. Here's some simple code: php Code:
So $thishandmoney and $lasthandmoney should be the same, right? And it usually is, except for every once in a while... For example, I had $1000, bet $1, and won. $lasthandmoney equals $1001, but $thishandmoney, after betting another $1, then equaled $1003! At first I thought it was my script, but I added a couple lines in miniplay.php, and I'm getting the same thing. Any ideas? |
|
#2
|
|||
|
|||
|
[Blackjack] RE: Weird Money (Bug?)
If you're trying to find out if you won or lost why not just look at the cards?
Funny Money... Just looked thru it all - think I worked out what's happening You got a BlackJack but it didn't add the winnings in until you called MakeBet |
|
#3
|
|||
|
|||
|
[Blackjack] RE: Weird Money (Bug?)
Well, I COULD look at the cards... money's a little simpler. Whatever.
And I thought about the Blackjack thing, but I have the script printing whenever it hits or holds. I've seen it hit once, then hold at 20, and the bug occurs. Unless 20 is blackjack. ;) |
|
#4
|
|||
|
|||
|
[Blackjack] RE: Weird Money (Bug?)
Oops... that's me, being anonymous. Here's an example I just ran: bank's at $1002, and I bet $1. I hit twice, and stand at 19, winning the hand. Thus, I should have $1003. But after MakeBet, I have $1005.
|
|
#5
|
|||
|
|||
|
[Blackjack] RE: Weird Money (Bug?)
ha! I think you got it, tchala. It finds the $lasthandmoney, then calls MakeBet(), but if you get blackjack, it'll count it as a win and add the money before $thishandmoney is called. That's what it is... thanks.
|
|
#6
|
|||||
|
|||||
|
[Blackjack] RE: Weird Money (Bug?)
First off looking at the cards is easy. Pinch Matt's BestVal() from blackjacklib.php and call it summat else (or write yer own)
php Code:
Or summat along those lines I'm doing a little test or 3 on the funny money thing - ley u know later The funny money thing is potentially quite bad as you're never sure how much you have and this may affect your betting at some point - looks like it's bet * 1.5 atm but with splits etc could be higher |
|
#7
|
|||
|
|||
|
[Blackjack] RE: Weird Money (Bug?)
It's not strange nor a bug. If you would check $result["status"] right after betting, you would see "HANDOVER" and conclude you had a BlackJack.
I agree it looks strange though when you look a it without this check... |
|
#8
|
|||
|
|||
|
[Blackjack] RE: Weird Money (Bug?)
At the end of the hand the status is always HANDOVER
HANDOVER don't mean you got a blackjack, it means the hand is over |
|
#9
|
|||
|
|||
|
[Blackjack] RE: Weird Money (Bug?)
true, but if you make a bet, and immediately after that the status changes to "HANDOVER", you know it must have been a Blackjack.
But to end all misunderstandings, i think it's best to count your money each time status is "HANDOVER", after each turn... |
|
#10
|
|||
|
|||
|
[Blackjack] RE: Weird Money (Bug?)
Counting it myself ain't a lot of good. Try going to your bank manager and saying 'I know I got $10 more in my account' - you won't get very far
The take the worst concievable problem - sod all chance of it happening - two winners are within $X * 1.5 at the end and the looser's last hand had a blackjack... Matt's our Bank manager - if at the end of the game he reckons we got $999 then we got $999 (no matter what we reckon) |
|
#11
|
|||
|
|||
|
[Blackjack] RE: Weird Money (Bug?)
Err... i lost it. Anyway, i'm interested in your testresults :-)...
By the way, where's Matt? I haven't seen him in a few days around here and I'ld like to see some form of acknowledgement for my subscription |
|
#12
|
|||
|
|||
|
[Blackjack] RE: Weird Money (Bug?)
That last post was mine.
|
|
#13
|
|||
|
|||
|
[Blackjack] RE: Weird Money (Bug?)
Well, just got around to weaving myself a little software butterfly net
Gonna go catch me a BlackJack and see what's happening... Got one - 2nd hand too! - let's go see what the little bugger's doing (thank god for PHP debuggers) |
|
#14
|
|||
|
|||
|
[Blackjack] RE: Weird Money (Bug?)
I can see exactly what's happening (dunno why yet)
The BlackJack I just trapped was actually a pair of aces so it split At the start of the hand I've got 990, I ante up 10 and get my cards (2 aces) so I got 980 left in the pot. It goes thru my play routine and comes out the other end with 970, the cost of the split having been deducted. I've got A+8 and a BJ, can't see dealer quite yet At this point state _should_ be HANDOVER but it's actually YOURTURN I step into MakeBet() and can see everything - dealer's bust with 6,4,2,K Dealer pays me 20 + 25 (stake back plus winnings - 1 win, 1 BJ) so I now got 1005 as he took off my 10 stake for this hand while in MakeBet() This time it's a normal hand - I go into my playcode with a 6+2 - he's got a 3 Coming out the other side he's been dead lucky (3, 8, K), I lost that hand but the status is correctly set to HANDOVER Everything works as expected from then on It's definitely the BlackJack |
|
#15
|
|||
|
|||
|
[Blackjack] RE: Weird Money (Bug?)
Yep... it is. My script wasn't registering blackjacks fast enough, so I wasn't seeing the pattern. It it kind of odd seeing your bank account jump or drop by 3x your bet. I rewrote the win/loss script, too, just to avoid this problem.
|