Friday, June 16, 2006

 
This Blog Maybe Illegal in Washington State

Washington State recently enacted a law making online gambling a felony.

I grew up in Washington State, I was born in Spokane, went to college in Pullman Washington and had a student internship in Renton Washington. I moved to Oregon for my first job more than 20 years ago.

I hadn't been through the Seattle area since I first moved to Oregon, but last fall needed to drive to Spokane from Clatskanie Oregon. The fastest way there was through Seattle.

When I moved from Seattle years ago there were no Indian Casinos (just smoke shops and fireworks stands that occasionally blew up). Now there are more Casinos visible from the freeway than McDonald's restaurants.

Also in the last 20 years Washington State has adopted a state lottery. The Washington State lottery currently advertises regularly on TV along site online poker sites.

Don't Write About Gambling In Washington

Washington State officials have interpreted the new law very broadly. Not only is gambling online illegal but linking to online casinos, hosting online casino advertising, or even talking about gambling. The irony of these positions hasn't escaped the eye of the Seattle Times. In a recent article the Times states:
All that, says the state the ads, the linking, even the discussing violates a new state law barring online wagering or using the Internet to transmit "gambling information."
"It's what the feds would call 'aiding and abetting,' " says the director of the state's gambling commission, Rick Day. "Telling people how to gamble online, where to do it, giving a link to it that's all obviously enabling something that is illegal."

The articles author, Danny Westneat, goes on to say:
Gambling officials told me The Seattle Times may be afoul of the law because we print a poker how-to column, "Card Shark," by gambler Daniel Negreanu. He sometimes tells readers to hone their skills at online casinos. And at the end of each column is a Web address, fullcontactpoker.com, where readers can comment.

According to the Washington State Gaming Commission:
The Washington State Gambling Commission was created to keep the criminal element out of gambling and to protect the public. The recently enacted
legislation supports the Commission's efforts at fulfilling that responsibility.

But in one added twist, not all online gambling is illegal. In 2004 the Washington State Legislature passed a law to bet on horse races online if you place the bet with a state licensed firm.

So the bottom line is you can legal gambling in card rooms in Washington, you go to Indian Casinos, you can by Washington Lottery Tickets, and you can play the ponies online. But don't play poker online, link to any poker sites, or even talk about online gambling on your website if you live in Washington.

Apparently online Casinos are putting the pinch on the states lively hood. Don't get in the way of the governor and his tax revenue, at least not in Washington.

Thursday, June 08, 2006

 
Combinations, Permutations, and Hand Values

You probably remember covering Permutations and Combinations in your High School math class. In case you missed that day of school, here's a quick summary.

Permutations are used when you care about order. For example, As Ks would be considered unique from Ks As. Combinations are used when order doesn't matter.

In Texas Holdem the hole cards As Ks (the ace of spades and the king of spades) are considered equivalent to Ks As. So combinations are used when calculating the number of hands.

The formula for combinations is nCk=n!/(k!*(n-k)!). To calculate the number of unique hole card combinations in Texas Holdem you substitute the following 52C2= 52!/(2!*(52-2)!) which is 1326 total hands.

In the Hand Evaluator library (available in the downloads area on the left), we use 52 bits of a 64 bit int as a hand mask. A hand mask describes a specific hand. Each of the 52 bits in the mask describe a specific card. When the bit is on the card is present. Combinations are used to describe the total number of possible unique hand masks.

The Hand Evaluator library also uses hand values. A hand value is the result of passing a hand mask into the Evaluate() method. What's returned is an integer value that can be used to determine which hands are of higher value than another.

So looking at the number of unique hand value is also an interesting thing to know. The following table shows the number of hand values, permutations and combinations (hand masks) that a hand of a specific number of cards requires.


The first time I saw anyone work through this was Cactus Kev. I found the results for 5 card hands to be, well, shocking. I never expected there to be only 7462 unique hand values for 5 card hands. Cactus Kev uses this fact to create a very fast hand evaluator algorithm.

What I found even more surprising (at least until I spent sometime thinking about it), was that 6 and 7 card hands have even fewer possible hand values.

Though this may seem like trivia, understanding this has been quite helpful to me. I hope it's useful for you.

Tuesday, June 06, 2006

 
A Pocket Query Language

I'm sure you've read a book or two on Holdem. One of the things I noticed while reading poker books is that there is a de facto standard for describing pocket cards. Most books use some variant of the following to describe pocket hands.


Most poker software that parse string representations of pocket hands only supports the first item in the de facto standard.

I've implemented a much richer query language. I support all of the common poker book syntax plus some extensions.

I've also added some operators.
Why a Pocket Query Language?


One of the things I've done too many times has been write code to analyze specific matchups. For example, have you ever wondered what the advantage is for have a suited connected verses a non-suited connector?

I'd guess you've probably wondered, but weren't enough of a masochist to write the code. On the other hand, I am enough of a masochist to write the code for many, many match ups. After awhile I decide I had enough of that and wrote a query language so that I could write my matchup analysis once and just put in query strings.

The following is an example of the result of using query strings rather than hard coded match ups. Oh and there is about a 5% advantage for suited connectors.



Using Pocket Queries in Code

I've attempted to make it trivial to write analysis code that utilized Pocket Queries. Here's an example.





using System;
using System.Collections.Generic;
using System.Text;
using HoldemHand;

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
// A Pocket Query Returns an array of all
// hands that meet the criterion.
ulong[] player1 = PocketHands.Query("Group3-Group5");
ulong[] player2 = PocketHands.Query("Axs");

// Holds stats
long player1Wins = 0, player2Wins = 0,
ties = 0, count = 0;

// Iterate through 10000 trials.
for (int trials = 0; trials < 10000; trials++)
{
// Pick a random pocket hand out of player1's query set
ulong player1Mask = Hand.RandomHand(player1, 0UL, 2);
// Pick a random pocket hand for player2
ulong player2Mask = Hand.RandomHand(player2, player1Mask, 2);
// Pick a random board
ulong boardMask = Hand.RandomHand(player1Mask |player2Mask, 5);

// Create a hand value for each player
uint player1HandValue = Hand.Evaluate(boardMask | player1Mask, 7);
uint player2HandValue = Hand.Evaluate(boardMask | player2Mask, 7);

// Calculate Winners
if (player1HandValue > player2HandValue)
{
player1Wins++;
}
else if (player1HandValue < player2HandValue)
{
player2Wins++;
}
else
{
ties++;
}
count++;

}

// Print results
Console.WriteLine("Player1: {0:0.0}%",
(player1Wins + ties/2.0) / ((double)count) * 100.0);
Console.WriteLine("Player2: {0:0.0}%",
(player2Wins + ties/2.0) / ((double)count) * 100.0);
}
}
}



This page is powered by Blogger. Isn't yours?