Thursday, June 29, 2006

Running it Twice: Analysis

Many poker spectators were recently introduced to the concept of "Running it twice" on the television show High Stakes Poker on GSN. When two players agree to "run it twice", they are agreeing to complete the hand with two sets of outcomes. If there is one card left to be dealt, then two cards will be dealt, each card acting as a the final community card for two separate outcomes. When a hand is run twice, the unknown cards are not shuffled between the two outcomes.

If you win both times, you win the entire pot. If you lose both times, you lose the entire pot. If you win one and lose the other, then the pot is divided in half and distributed to the two players. Players who opt to run the hand twice are trying to lower the variance of the outcome. When you run a board twice, you are giving up some of your odds of winning in exchange for tieing a good percent of the time. This is an option that is only available in a cash game (as opposed to a tournament). In a tournament, players are not allowed to make any deals that affect their chip stacks.

It is easy to see that your variance will go down. There are many opportunities to tie and your chances of winning or losing both decrease. What many people do not immediately understand is that your expected value (EV) does not change.

The easiest non-trivial situation to analyze is a one outer situation with one card to be dealt. An example of this would be
Player 1: 2♥ 3♥
Player 2: A♥ K♥
Board: 4♥ 5♥ 9♣ Q♥

Both players have flushes, but player 2 has the higher flush. The only way player 1 can win is if the river is a 6♥, making a him a straight flush. There is a 2.27% chance that he will hit his one outer (1/44 chance). The total EV of this situation is 0.0227.

If the players run the board twice, he has absolutely NO chance of winning. Since cards are not shuffled between the deals, it is impossible to hit his one out both times. He does have a 4.55% chance of tieing though.

This is easy to calculate because it is 1 - the probability of losing. The probability of losing is (43/44) x (42/43). When calculating the EV for the 2x board, it is just the probability of winning plus the (probability of tieing)/2.

EV = Pwin + 0.5 Ptie


EVrun it 1x = 0.0227 + 0.500 x 0.000 = 0.227

EVrun it 2x = 0.000 + 0.500 x 0.0455 = 0.227

I created an Excel spreadsheet with all of the possible outcomes for every situation with 1 or 2 cards to come (assuming there is no possibility of tying or redrawing). In every situation, the EV is identical.

Download Spreadsheet

Saturday, June 17, 2006

Synergy Keyboard and Mouse Sharing

Working with multiple computers at the same time can be a pain if you don't have everything set up nicely. Many people use some type of KVM device to share the same Keyboard, Monitor (V=Video) and Mouse. Typically, you will plug one keyboard, one monitor and one mouse into the KVM and then plug special cables from the KVM into each of the servers. You can switch which computer you are controlling by pressing a button on the KVM or pressing special keyboard combinations.

Another option is to use an open-source program named Synergy. Synergy allows you to use the same keyboard and mouse for multiple computers. Each computer still uses its own monitor. When you roll your mouse cursor off one monitor, it will appear on the monitor of your other computer.

The biggest difference between a KVM and Synergy is that Synergy is a software solution. The keyboard and mouse actions are sent from one machine to another over the local network. Synergy can be used on different operating systems including Windows, Mac and Linux. This is an awesome solution if you have a lot of computers, a lot of desk space and a lot of monitors.

Who Needs Synergy?
At my work, our QA team has to run multiple operating systems at their desks. They also have the luxury of having 3 twenty-inch (and sometimes 24") flat panel displays at their disposal. Their PCs typically have a dual monitor set up and the third monitor is hooked up to their Mac. This allows them to bounce back and forth between computers without pressing a button on a KVM. It also allows them to watch processes on both computers concurrently.

Setting Up Synergy
First, you must decide which computer will be the server. The server is the computer whose keyboard and mouse will be shared. The other computers will be clients. To set up Synergy, you must do the following (in this example the server is on the right and the client is on the left):

Download the executable from
Install the program on the client
In the Synergy program window, make sure the "Use another computer's shared keyboard and mouse (client)" radio button is selected
Type in the name of the server in the "Other Computer's Host Name" textbox

Click the AutoStart button
Click the Install button under the "When Computer Starts" text

Now click "Start"
That's all you need to do for the clients!

Install the executable on the server
In the Synergy program window, make sure the "Share this computer's keyboard and mouse (server)" radio button is selected
Click the "Configure..." button
Click the "+" button under Screens
Type in the Server's name under "Screen Name" and click OK

Click the "+" button under Screens again
Type in the Client's name under "Screen Name" and click OK
In the "Links" section, set it to "0 to 100% of the left of [RIGHT_COMPUTER] goes to 0 to 100% of [LEFT_COMPUTER]" and then click the "+" button
In the "Links" section, set it to "0 to 100% of the right of [LEFT_COMPUTER] goes to 0 to 100% of [RIGHT_COMPUTER]" and then click the "+" button
Click the OK button on the "Screens & Links" window
On the main Synergy window, click the AutoStart button
Click the "Install" button in the "When Computer Starts" section
Finally, click the "Start" button in the main Synergy window

Now, run your mouse off the left of the server onto your other computer! w00t!

Monday, June 05, 2006

Save this to disk, bitch!

Microsoft's Internet Explorer has a nice security "feature" that prevents you from saving certain files to your hard drive if the web site is using the https protocol. This is most noticable with Microsoft Office documents. This is true whether the file is saved on the web server or if it is generated and served as a byte stream.

With Internet Explorer 6 Service Pack 1, the default setting changed to "Do not save encrypted pages to disk". This was done in an effort to prevent certain files from residing in the Temporary Internet Files folder once the user has logged off. The affect of this is that NO ONE can save certain file types at all (most notably XLS, and DOC files).

If you have access to an SSL protected public web server, all you need to do is save an Excel spreadsheet on the server to see this in action. Upload the file and try to access it over the https protocol (make sure that XLS files are set to "Confirm open after download" under Control Panel | Folder Options | XLS | Advanced | Open). You should get a popup that looks like the following:

Notice that the filename changed from test.xls to test_xls. That is the first sign that something has gone wrong. If you try to save or open the file, you get another error:

This is easy to resolve if you are the user. Just make 5 clicks and you can undo Microsoft's "security enhancement". The big problem is when you are the one running a web site and your Customer Service team gets thousands of complaints from non-skilled internet users.

One super easy way to get around this issue is to use an IFRAME. If you have a blank page that just contains an IFRAME with the width and height set to 100%, you will get the appropriate prompt to save the file.

<body topmargin="0" leftmargin="0">
<iframe src="test.xls" width="100%" height="100%" />

This seems to work well and FireFox supports IFRAMEs, so it is cross-browser compliant. Yes, this is a complete hack, but don't blame me, blame Microsoft. If you want to get sophisticated, you can check the USER-AGENT value and only implement this solution for IE 6.

I finally figured this out after almost an entire fun-filled day of trial and error.