June 2009
« May   Jul »



When casinos go broken

What’s wrong with this picture?  I’ve taken the liberty of enlarging the relevant text (or you can click to view the full original screenshot).

Balance £3.  Which means I have insufficient funds to place a £2 bet.

Let me try to take a stab at explaining what kind of logic is needed to come to this absurd conclusion.

Three Card Poker requires you to place an additional bet equal to your ante if you want to play the hand.  You can fold and forfeit the ante – but if giving up without a chance is only option you wouldn’t start the hand in the first place.  So in fact this £2 bet (including a £1 “pair plus” prop bet) actually needs me to have £3 in my balance to play it.

Which, it appears, I do.

[Side note: This is different to blackjack, where the game will never stop you from dealing a hand if you don’t have enough money to double down or split a pair.  You are at least able to complete the hand and stand a chance of winning something without using these options.]

However we already know that Gala suffers from fraction-of-a-penny rounding errors.  It’s not too much of a stretch to imagine that their bodgeroonie of a cashier system actually thinks my balance is very slightly below £3, but close enough to it that it is rounded up when displayed.

It’ll be some number like £2.999999995673, so that when asked “does he have at least £3?” then answer will be “ooooooh not quite”.

I see this kind of rounding error fairly often when working with decimal numbers.  It’s because computers suck at fractions.  Everything has to be stored internally as some representation of a power of 2, so only fractions with a denominator of 2, 4, 8, 16, etc can be stored exactly.

When working in hundredths, that’s just 4% of all numbers: those ending in .00, .25, .50 or .75; everything else is going to be converted to a (fairly long) decimal approximation; close, but not precise.  However, if you know that it happens, it’s not that hard to deal with.

Notably in the poker and casino operator APIs I’ve worked with, you don’t need to worry about this.  They have always stored and returned the player balance numbers as a whole number of pence or cents.  It makes it pretty easy to accidentally conjure money out of thin air – you just have to forget to divide by 100 one time – but it means that there are never any fractions of a penny floating around the system to go wrong.

In fact, some poker networks even store and return your player points balance as a whole number of hundredths of a point.  I guess they really don’t want to give much away!

My assumption is that Gala’s cashier system stores the casino balances as pounds and pence – a design decision that has side effects they either don’t know about or don’t care about.  For a system that handles real money transactions this is, frankly, a bit poo.

And if anyone from Gala actually reads this: yes, I could do (and have done) better.  Let’s talk.

Anyway, there’s more.  I really can’t begin to explain what the hell is going on this time.  The dealer’s cards were dealt, briefly flashing face up – but too quickly for me to remember what it showed.  They flipped over as soon as they were dealt, and then the game announced the apparent straight flush for the dealer you (don’t) see here.  Like I’m just meant to believe that?

NaN” means “not a number”.  Or, in English, “something fucked up”.

Isn’t it great to know that when the game software has a glitch, the default behaviour is to give the dealer the very best hand possible?