Open Side Menu Go to the Top
Register
Poker Hand Database setup? Poker Hand Database setup?

11-24-2014 , 01:31 AM
I'm working with SQL Server and C# in Visual Studio. Currently writing code to parse poker hands, but would like some ideas on how to show betting action with SQL tables.

I'm considering separate tables for each betting round Preflop, Flop, turn, River. I'd like to get as much information as possible so I could query for every possible betting pattern.

I'm having trouble trying to figure out how to deal with entries where the betting was "reopened". Bet call is easy to interpret in a table entry, but what about a bet raise re-raise all-in?
Poker Hand Database setup? Quote
11-24-2014 , 06:37 AM
Have you tried the ******** handparser? Its fast(10+kh/s) and well tested.

Sent from my C6603 using 2+2 Forums
Poker Hand Database setup? Quote
11-24-2014 , 10:11 AM
Interesting, I'm sure my hand parser is going to be slow and buggy, but I'm doing this for my own education. This is the stuff that nobody knows how to do at my day job.

I'll look into the closure table.

Thanks, CV
Poker Hand Database setup? Quote
11-25-2014 , 03:31 PM
I looked at the Closure Table structure, and I'm a little confused. Could you give me a quick example of how the pre-flop action below could be represented in a table. I would like to be able to query the limp/call of UTG+2.

Small Blind : Ante/Small Blind $0.10
Big Blind [ME] : Big blind/Bring in $0.25 UTG : Folds
UTG+1 : Folds
UTG+2 : Calls $0.25
UTG+3 : Folds
UTG+4 : Raises $1 to $1
UTG+5 : Folds
Dealer : Calls $1
Small Blind : Folds
Big Blind [ME] : Folds
UTG+2 : Calls $0.75

I was going to show my try but, it is totally worthless. I'm looking for a hint to get me going in the right direction.

Thanks CV
Poker Hand Database setup? Quote
11-25-2014 , 07:17 PM
I think I'll just go with this format. http://poker.cs.ualberta.ca/IRCdata/README.TXT
Poker Hand Database setup? Quote
11-26-2014 , 11:45 PM
I just did a long write-up and deleted it.

Here is a link to the PT3 schema:
http://www.pokertracker.com/guides/P...sessionsummary

I'd probably just download PT3 or HEM, then either hook C# to PostgreSQL or just get it to work on SQL Server instead.
Poker Hand Database setup? Quote
11-27-2014 , 12:14 AM
... and if you are still thinking of rolling your own, I can post up the answer to your question above.
Poker Hand Database setup? Quote
11-27-2014 , 08:28 AM
I hate to be "that guy", but I feel like if you want results, there are existing solutions you could use, and that if you want to learn, this is an exceptionally messy problem that won't teach much that can be applied generally.

Like, far be it from me to dictate to people what they do for recreation, but this line:

Quote:
This is the stuff that nobody knows how to do at my day job.
Seems to suggest that you're taking something you're familiar with and interested in (poker) and are using it to learn about databases and programming. If so, you have definitely chosen the wrong subject to try to learn with.

I would reassess your goals here, and unless your goal is recreation, I would abandon poker. I know your first reaction is regardless going to be "BUT I LIKE POKER! **** YOU!" but I promise the whole experience will be discouraging for you. Programming at its best has a satisfying elegance, poker programming is horrible and bogged down in detail. I know from experience.

If you're doing this to learn, give us your day job in broad terms and somebody can probably suggest a better project.
Poker Hand Database setup? Quote
11-27-2014 , 12:25 PM
ChrisV, I pretty much agree with you. Trying a poker project to learn programming is about the worse thing you could ever try.

I do think there is *some* value in doing a poker project when you reach a certain level of sophistication though. The real world is incredibly messy, full of edge-cases, and often requires attending to those ugly details. I think this is a function of how you like to approach programming. Personally, I like dealing with ugliness, but I've met a few people who don't like it.

I will disagree that there is no elegance. It takes a lot of work to find it, but it is there. I probably learned more from programming my silly poker bot than any other project I have worked on, but that learning wouldn't be possible without the 2 years of study I did beforehand.
Poker Hand Database setup? Quote
11-27-2014 , 06:58 PM
just use the FPDB open source tracker
Poker Hand Database setup? Quote
11-29-2014 , 04:05 PM
What would you suggest I try to program to learn C# and SQL? I have to use SQL Server to run backend queries on our Business database. The database is an Infor ERP system. A great benefit to me would to be able to run C# programs to modify data quicker than the current user interface allows. Of course without crashing the system. We have an outside con$ultant that does these things.

By the way, this poker database problem is getting me to sit down and "do the time". I'm finally learning how to deal with classes. I'm actually learning a lot. So FU!

CV

Last edited by BoisePokerPlayer; 11-29-2014 at 04:19 PM.
Poker Hand Database setup? Quote
11-29-2014 , 04:31 PM
There are 3 of us saying you shouldn't do this, which should be a strong indication that we aren't all pulling your leg. Yes, you are right, being interested in a project may be helpful, but Michelangelo couldn't carve Pieta without learning how to carve soap long before.

Just look at the size of the schema I linked above:
-- does it look like something you'd be able to create with no experience?
-- Can you identify the mistakes they made in that schema?
-- Would you be able to improve it even if you could identify the mistakes?

Why do you want to learn C#?

Why do you want to learn SQL?

I think it is important to be open-minded about what you learn in programming. When you approach it with the attitude that you should focus on learning to some end-goal, you are limiting yourself to a small subset of ideas and ignoring other possible routes of interest. The real danger is that you may miss a handful of gems that would get you closer to this end-goal of making this poker software you'd like to make, and that attitude will ultimately prevent you from achieving your goal.

What is your programming background?
Poker Hand Database setup? Quote
11-30-2014 , 11:17 AM
Yeah I see some issues, but I don't want to debate them here.

I've already started building the hand parser and figured out how to connect to an instance of SQL Server Express, and wrote some code in Visual Studio to run a query. I was surprised I was able to get it to work on my first try. I know that my database won't be exactly what I want the first time around. I expect to revise it multiple times. The goal right now it to get something working. I can't believe that any programmer made the perfect database in their very first try.

Why C# ..... I already invested a semester in collage (BSU) learning the language. I have books on it and I feel comfortable using Visual Studio.

Why SQL and Microsoft SQL Server....The ERP system at my work runs on top of an SQL Server Database. I've already written some custom reports using SSRS.

I also write VBA code for Windows Office. It's amazing that the small amount of programming I have done has already influenced my position at work.
Poker Hand Database setup? Quote
12-04-2014 , 10:17 AM
Designing this sort of DB as others have mentioned is difficult! But it's a fun challenge, and you will learn a lot.

I'd recommend starting off with storing all the raw HH's somehow, and not disposing of them when you process them. This will allow you in the future to change the DB structure, add new columns etc without losing any data or having partially populated data by reprocessing the original HHs.

I'd also strongly consider boiling your problem down to one variant of poker, tackling NLHE, LHE and Omaha all together might be too much to handle.

A good starting point would be two tables, "Players" and "Sites":

Players
ID
SiteID
Username
TotalHandsPlayed

Sites
ID
Name

Now run through you data, and populate those tables. That's where I'd start from anyway.
Poker Hand Database setup? Quote
12-05-2014 , 12:12 PM
I'll have some time during the winter break. I'll see how much I can get done. REGEX is my friend.

CV
Poker Hand Database setup? Quote
12-05-2014 , 12:32 PM
Quote:
Originally Posted by BoisePokerPlayer
REGEX is my friend.
I'd consider writing your own parser.
Poker Hand Database setup? Quote
12-05-2014 , 03:09 PM
Quote:
Originally Posted by Gullanian
I'd consider writing your own parser.

Well yes, I was just happy I found the "System.Text.RegularExpressions" (REGEX) class in Visual Studio C#. It works a heck of a lot better than the basic string parsing methods I was trying. With REGEX I can store multiple values from a string with just one line of code.

I guess I just don't want to dig that deep if VS already has a class that does exactly what I need.

CV
Poker Hand Database setup? Quote

      
m