We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1d2bb6d commit 220dfdfCopy full SHA for 220dfdf
src/poker/compare_hands.py
@@ -0,0 +1,19 @@
1
+def compare_hands(hand1, hand2):
2
+ """
3
+ Compare two poker hands and determine the winner.
4
+
5
+ Args:
6
+ hand1 (list): The first poker hand.
7
+ hand2 (list): The second poker hand.
8
9
+ Returns:
10
+ str: A message indicating which hand wins or if it's a tie.
11
12
+ # Placeholder for actual comparison logic
13
+ # This should be replaced with the actual implementation that compares the hands
14
+ if len(hand1) > len(hand2):
15
+ return "Hand 1 wins"
16
+ elif len(hand1) < len(hand2):
17
+ return "Hand 2 wins"
18
+ else:
19
+ return "It's a tie"
tests/poker/test_compare_hands.py
@@ -0,0 +1,28 @@
+def test_compare_hands():
+ from poker.compare_hands import compare_hands
+ from poker.card import Card, Face, Suit
+ # GIVEN
+ hand1 = [
+ Card(face=Face.KING, suit=Suit.CLUBS),
+ Card(face=Face.NINE, suit=Suit.SPADES),
+ Card(face=Face.KING, suit=Suit.SPADES),
+ Card(face=Face.KING, suit=Suit.DIAMONDS),
+ Card(face=Face.NINE, suit=Suit.DIAMONDS),
+ Card(face=Face.THREE, suit=Suit.CLUBS),
+ Card(face=Face.SIX, suit=Suit.DIAMONDS)
+ ]
+ hand2 = [
20
21
22
23
24
+ # WHEN
25
+ result = compare_hands(hand1, hand2)
26
27
+ # THEN
28
+ assert result == "Hand 1 wins" # Adjust based on actual implementation logic
0 commit comments