Sunday, July 23, 2006

Doing the "What If?" Shuffle

What if?Just listened to the latest installment of PokerDiagram, the podcast in which two Londoners play online poker tourneys (SNGs, MTTs) and narrate their adventures as they do. If you haven’t heard it yet, go check it out. The show’s hosts, Henry and Zog, are quick-witted and knowledgeable, and they interact in ways that usually make the show entertaining and even compelling. (See my earlier post for a review of PokerDiagram.)

During this particular show (episode 42, titled “Cheers!”), Zog enters a $20+$2 MTT on PokerRoom (their favorite site). After struggling for a good while, Zog finds himself sitting in 36th place out of 44 remaining players with about 1900 chips, something like a third of the average stack size. The blinds are 100/200 and only the top ten places pay, so he’s feeling a bit of pressure to make a move when he gets dealt T9-suited in the big blind. The Zogster really wants to play the hand, but sees a substantial raise from one player and a call from another before the action gets back to him. The duo hem and haw a bit before Zog finally says “It’s close, but I’m gonna fold this.” No longer in the hand, they watch the flop come T9x and momentarily express disappointment at what appears to have been a missed opportunity.

We’ve all been there. Just today I had a hand in a $0.50/$1.00 limit ring game where I was dealt 5h8c in the small blind and after deciding it wasn’t worth the quarter to complete watched the flop come 7h4h6c. Why didn’t I call!? It was just a quarter! Then I remembered Zog having said something about how “it’s not a preshuffled, prearranged deck” when one plays online. The subject came up again later in the show, and Henry and Zog make it clear that it is their understanding that the cards are randomized at every stage of the hand, not arranged in a particular sequence before the hand and left unchanged (as would be the case in a live game). In other words -- if I’m understanding the pair correctly -- they believe that flop might not necessarily have come T9x if Zog had called.

I wondered if this were in fact the case -- if the sites don’t “set the deck” with each hand but in fact apply their shuffling software to each and every card that comes off. If I'm going to call myself a shamus, I figured some detective work was in order.

I have no account at PokerRoom, so I went over to PokerStars (where I do) and checked out what they say on their website about their shuffling software. How can they guarantee the deal is really random? Well, as they explain it, they ensure “a fair and unpredictable shuffle” by constantly gathering a great deal of “truly random data” that is then used as source material affecting the order in which the cards are dealt for a given hand. In other words, PokerStars randomizes its shuffle by figuring other, independently-produced information into the equation.

Here’s an analogy: Pauline knows her husband, Bruce, likes to have either a ham sandwich or vegetable soup for lunch. She also knows Bruce doesn’t like knowing beforehand what she’s made him for lunch, he so enjoys being surprised each day when he opens his lunchbox. (Bruce is easily amused.) So each morning Pauline makes up both lunches, places them in identical lunchboxes, and watches as Bruce grabs one off the kitchen table as he leaves for work. In order to make sure his choice is “fair and unpredictable,” Pauline checks the weather report in the newspaper to see what the high temperature is forecasted to be that day. If the forecasted high is an odd number of degrees Fahrenheit, she places the lunchbox with the ham sandwich nearest the door. If it is an even number, she places the lunchbox with the soup nearest the door.

The weather report provides Pauline source material with which to help randomize her placement of the lunchboxes, and thus, Bruce's selection. Similarly, PokerStars gathers what it considers “truly random data” to plug into its software in order to produce a random (or “fair and unpredictable”) shuffle. While Pauline only uses one piece of information for this purpose, PokerStars says it gathers 249 “random bits” and enters them all into their shuffling software in order to produce the deal. Pauline gets her one “bit” from the local newspaper; the PokerStars software -- the random number generator that determines what cards are dealt -- gathers its 249 random bits from two primary sources.

One source is the “thermal noise” produced by a resistor -- that is, the genuinely unpredictable fluctuations that occur when voltage is applied to that resistor. These fluctuations are measured and redistributed as some of the “bits” needed by the random number generator. I imagine this must be a machine or computer of some sort rigged up somewhere in Costa Rica (where PokerStars is headquartered) with lots of measuring instruments taking down various data related to the fluctuations and pumping those numbers into its randomization program.

The other source of random bits might surprise you. It’s us. That’s right -- the players. Data is gathered from “a summary of mouse movements and events timing” and used along with the thermal noise data to determine the ultimate order of the cards. So the amount of time you spent deciding whether to check, raise, or fold actually affects the order in which the cards across the site are being randomized. Of course, we’re talking about at any given moment tens of thousands of players’ movements affecting hundreds of thousands of deals, so there’s little hope of precisely tracking the effect of how one person moves his or her mouse and the timing of his or her clicks. But such actions do, most definitely, affect the process of randomization. (Reminds one more than a little of the butterfly effect, from chaos theory.)

All of this information was very diverting, but my question hadn’t really been answered by any of it. Would I have made my straight had I played my crappy 58 on that hand with the 746 flop? I wrote PokerStars support an email asking them whether or not the randomization process is applied multiple times throughout the hand (e.g., before the deal, before the flop, after the flop, after the turn) or if it is only applied once prior to the hand. As usual with PokerStars, they got back to me very quickly (in less than two hours). Here is what they had to say:

PokerStars responds to Shamus's query

I would have made my straight! It didn’t matter whether I hesitated or moved the mouse around the screen before folding -- the order of the cards for that particular hand already had been determined and would not change, regardless of the action. Zog and Henry’s claim about there not being a “preshuffled, prearranged deck” wasn’t the case here . . . ! PokerStars does, in fact, "set the deck" (as what they call a "virtual stub").

I wondered if perhaps PokerRoom does things differently, so even though I don’t have an account with them I sent them a message asking the same question. Half a day later, they've yet to get back to me. If they do, I'll post their response. Meanwhile, I'll just keep on wondering what if . . . .

(Click here to read the follow-up post.)

Photo: Tom Neal from the 1945 film Detour, public domain.

Labels: , , , ,

2 Comments:

Blogger Simon said...

Interesting post, from a software design view point it makes sense to shuffle the deck once at the start of the hand (less processing required throughout the hand). Will be interesting to hear how PokerRoom does it.

At the end of the day though, regardless of how the shuffling takes place it's not going to change the way you play (sure it's only 25c but 56o?), as long as it's truly random it's all good.

I'm more concerned about the amount of non-random shuffling that occurs at my home games - but that's a another topic.

7/24/2006 10:19 AM  
Anonymous Anonymous said...

Nope Simon, unless YOU know the specific requirements of a particular software program, any particular logic routine does NOT "make sense from a software design view point."

The priority of requirements for online poker software may or may not place much importance on server load and/or processing cycles - compared to data storage, data security, audio/video presentation, financial data processing/transmission, randomness of game play, tracking player rewards/play patterns, etc.

From a programmer's standpoint, yes you may want to process less cycles, but it's hardly a given from the customer's viewpoint.

Could too much processing during a game cause issues - obviously. Lockups, crashes, etc. But it's even more important that data integrity be maintained, and that the game be perceived as fair to the players. You can see this in the Poker sites that do go down on occasion. The programmer's wet dream of ultimate efficiency is many times too expensive in both cost and dev time to achieve. Welcome to the world of compromise.

9/22/2006 3:16 PM  

Post a Comment

<< Home

Newer Posts
Older Posts

Copyright © 2006-2021 Hard-Boiled Poker.
All Rights Reserved.