<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,4 +1,5 @@
-2009-01-24 (0.4.0)
+2009-06-21 (0.4.0)
+    * Bug [#26276] improper two_pair? behavior. Applied patch by Uro.
     * Renamed Deck.shuffle to Deck.shuffle! in the sample Deck class
     * Changed protected methods in PokerHand to private
     * Added natural_value method to Card</diff>
      <filename>CHANGELOG</filename>
    </modified>
    <modified>
      <diff>@@ -185,12 +185,12 @@ class PokerHand
     # \1 is the face value of the first pair
     # \2 is the card in between the first pair and the second pair
     # \3 is the face value of the second pair
-    if (md = (by_face =~ /(.). \1.(.*) (.). \3./))
+    if (md = (by_face =~ /(.). \1.(.*?) (.). \3./))
       # to get the kicker this does the following
       # md[0] is the regex matched above which includes the first pair and
       # the second pair but also some cards in the middle so we sub them out
-      # then we add on the cards that came before the first pair, the cards that
-      # we in between, and the cards that came after.
+      # then we add on the cards that came before the first pair, the cards
+      # that were in-between, and the cards that came after.
       arranged_hand = arrange_hand(md[0].sub(md[2], '') + ' ' +
           md.pre_match + ' ' + md[2] + ' ' + md.post_match)
       arranged_hand.match(/(?:\S\S ){4}(\S)/)</diff>
      <filename>lib/ruby-poker.rb</filename>
    </modified>
    <modified>
      <diff>@@ -114,6 +114,8 @@ class TestPokerHand &lt; Test::Unit::TestCase
     end
   
     should &quot;return the correct number of cards in the hand&quot; do
+      assert_equal(0, PokerHand.new.size)
+      assert_equal(1, PokerHand.new(&quot;2c&quot;).size)
       assert_equal(2, PokerHand.new(&quot;2c 3d&quot;).size)
     end
   
@@ -145,6 +147,16 @@ class TestPokerHand &lt; Test::Unit::TestCase
       ph.delete(&quot;Ac&quot;)
       assert_equal(Array.new, ph.hand)
     end
+    
+    should &quot;detect the two highest pairs when there are more than two&quot; do
+      ph = PokerHand.new(&quot;7d 7s 4d 4c 2h 2d&quot;)
+      assert_equal([3, 6, 3, 1], ph.two_pair?[0])
+      # Explanation of [3, 6, 3, 1]
+      # 3: the number for a two pair
+      # 6: highest pair is two 7's
+      # 3: second highest pair is two 4's
+      # 1: kicker is a 2
+    end
   
     context &quot;when duplicates are allowed&quot; do
       setup do</diff>
      <filename>test/test_poker_hand.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>bcc1291a08470d51749db74ace7b79f6e54257b7</id>
    </parent>
  </parents>
  <author>
    <name>Robert Olson</name>
    <email>rob@thinkingdigitally.com</email>
  </author>
  <url>http://github.com/robolson/ruby-poker/commit/2596a4d90a99cee8f62c1fb014b98ff266fc2c5e</url>
  <id>2596a4d90a99cee8f62c1fb014b98ff266fc2c5e</id>
  <committed-date>2009-06-21T01:04:32-07:00</committed-date>
  <authored-date>2009-06-21T01:04:32-07:00</authored-date>
  <message>Bug [#26276] improper two_pair? behavior. Applied patch by Uro.</message>
  <tree>ee3e26fbfd0bf1700cef928c44e489c957fbaea7</tree>
  <committer>
    <name>Robert Olson</name>
    <email>rob@thinkingdigitally.com</email>
  </committer>
</commit>
