<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: How do I check for poker hands in Java?</title>
	<atom:link href="http://learnaboutpoker.org/how-do-i-check-for-poker-hands-in-java/feed/" rel="self" type="application/rss+xml" />
	<link>http://learnaboutpoker.org/how-do-i-check-for-poker-hands-in-java/</link>
	<description>How to go from poker novice to expert in the shortest time.</description>
	<lastBuildDate>Thu, 14 Apr 2011 22:54:36 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>By: videobobkart</title>
		<link>http://learnaboutpoker.org/how-do-i-check-for-poker-hands-in-java/comment-page-1/#comment-585</link>
		<dc:creator>videobobkart</dc:creator>
		<pubDate>Fri, 12 Mar 2010 15:57:26 +0000</pubDate>
		<guid isPermaLink="false">http://learnaboutpoker.org/how-do-i-check-for-poker-hands-in-java/#comment-585</guid>
		<description>There won&#039;t be any trick to it.  You will have a series of methods, each one taking an array of 5 cards and returning a boolean.  One for each kind of hand you are trying to detect.  Then the code within each method must just do the appropriate checks.  It will be somewhat detail-oriented but I don&#039;t see a way around it.

For example:

isPair - look at each card and see if there is another in the hand of the same rank

isThreeOfAKind - similar to isPair but must find two other cards with the same rank as each chosen card

isFlush - take the first card, note its suit, then check that the other four cards have that same suit.

isStraight - find the lowest card, then check that among the other four cards there is a card with each of: one higher rank, two higher rank, three higher rank, and four higher rank.  With Aces being either low or high there will be some additional work in this method to accommodate that.

isStraightFlush - could be implemented by calling isStraight and isFlush and only returning true if those are both true

isRoyalFlush - first check for isStraightFlush then check that the lowest card has rank 10.

You get the idea.

One detail to consider is whether you want to consider three-of-a-kind as a pair, since technically there are two cards with the same rank.  If not, then the code for IsPair will have to also call isThreeOfAKind (and isFourOfAKind) and not return true if any of those are true.

Wild cards will complicate these methods of course.  Then they will need a way of knowing what is wild as they look at the cards to see if they meet the requirements of the kind of hand they are checking for.</description>
		<content:encoded><![CDATA[<p>There won&#8217;t be any trick to it.  You will have a series of methods, each one taking an array of 5 cards and returning a boolean.  One for each kind of hand you are trying to detect.  Then the code within each method must just do the appropriate checks.  It will be somewhat detail-oriented but I don&#8217;t see a way around it.</p>
<p>For example:</p>
<p>isPair &#8211; look at each card and see if there is another in the hand of the same rank</p>
<p>isThreeOfAKind &#8211; similar to isPair but must find two other cards with the same rank as each chosen card</p>
<p>isFlush &#8211; take the first card, note its suit, then check that the other four cards have that same suit.</p>
<p>isStraight &#8211; find the lowest card, then check that among the other four cards there is a card with each of: one higher rank, two higher rank, three higher rank, and four higher rank.  With Aces being either low or high there will be some additional work in this method to accommodate that.</p>
<p>isStraightFlush &#8211; could be implemented by calling isStraight and isFlush and only returning true if those are both true</p>
<p>isRoyalFlush &#8211; first check for isStraightFlush then check that the lowest card has rank 10.</p>
<p>You get the idea.</p>
<p>One detail to consider is whether you want to consider three-of-a-kind as a pair, since technically there are two cards with the same rank.  If not, then the code for IsPair will have to also call isThreeOfAKind (and isFourOfAKind) and not return true if any of those are true.</p>
<p>Wild cards will complicate these methods of course.  Then they will need a way of knowing what is wild as they look at the cards to see if they meet the requirements of the kind of hand they are checking for.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

