Two Plus Two Older Archives  

Go Back   Two Plus Two Older Archives > General Gambling > Computer Technical Help

Reply
 
Thread Tools Display Modes
  #1  
Old 08-05-2005, 10:39 AM
LetYouDown LetYouDown is offline
Senior Member
 
Join Date: Mar 2005
Location: Sharing a smoke w/negativity
Posts: 524
Default Programming - Ranking Hands (C#)

Not sure if this is the correct forum for this...or if one even exists, but figure I'll ask anyway. I'm a programmer and I've given thought recently to writing some poker software. I typically use C#.NET, so if anyone can answer this with that syntax, it might save time.

I'm looking for an extremely efficient method of ranking both 5 and 7 card hands. 5 cards alone would be a good start. I don't really want to reinvent the wheel and spend time coding something that's readily available/efficient.

I found this: http://www.codeproject.com/csharp/Po...BotChallan.asp and I downloaded the libraries and can load cards in, but for some reason it doesn't seem to want to rank them. I've read the article several times and the concepts are well documented, but the function usage doesn't seem to be. The method he uses for hand ranking seems extremely efficient. Anyone have a solution out there that works?
Reply With Quote
  #2  
Old 08-05-2005, 11:28 AM
TheTROLL TheTROLL is offline
Senior Member
 
Join Date: Feb 2005
Location: London
Posts: 103
Default Re: Programming - Ranking Hands (C#)

The function

private void EvaluateHand(Hand h)

in PokerGames5Cards.cs appears to be the relevant one, it takes a hand object as an argument and sets the type property to one of the type enums.

Nothing too earth-shattering about the approach, just works down from Royal Flush to High Card stopping at the first match. It looks like the hand object can hold more than five cards, but the way of selecting the best 5-card hand from them is rubbish - it just tries every combination.
Reply With Quote
  #3  
Old 08-05-2005, 11:44 AM
LetYouDown LetYouDown is offline
Senior Member
 
Join Date: Mar 2005
Location: Sharing a smoke w/negativity
Posts: 524
Default Re: Programming - Ranking Hands (C#)

Yeah, I found the appropriate method, it seems very unorganized and illogically named. Why he didn't just implement a Hand.Rank() property directly, without having to create an instance of that class is beyond me.

Determining what category each hand falls into is pretty elementary...I just found the bit shifting aspect interesting for determining a numerical rank for a given hand.
Reply With Quote
  #4  
Old 08-05-2005, 02:02 PM
JoePro JoePro is offline
Senior Member
 
Join Date: May 2005
Posts: 206
Default Re: Programming - Ranking Hands (C#)

Yeah, I don't understand why he returns an arraylist of all combinations, then sorts them out to return your best hand. If he tweaked it a little, he'd be able to determine kickers, if two players held the same hand.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:35 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.