1

Code I'm using for card checking

def pair(player_hand):
  for x in range(1,len(player_hand)):
    if player_hand[x-1][0] == player_hand[x][0]:
      return True
  return False

def triple(player_hand):
  for x in range(2, len(player_hand)):
    if player_hand[x][0] == player_hand[x-2][0]:
      return True
  return False

def flush(player_hand):
  if player_hand[0][1] == player_hand[1][1]==player_hand[2][1]==player_hand[3][1]==player_hand[4][1]:
    return True
  else:
    return False
def straight(player_hand):
  for x in range(0,len(player_hand)-1):
    if(rank(player_hand[x]) + 1 != rank(player_hand[x+1])):
      return False
  return True

I know how to do a normal flush

def flush(player_hand):
  if player_hand[0][1] == player_hand[1][1]==player_hand[2][1]==player_hand[3][1]==player_hand[4][1]:
    return True
  else:
    return False

But how do I check for a specific order of cards for royal flush?

Darren Pan
  • 11
  • 1
  • 1
    For a Royal flush, just just that it is a flush and that the set `{player_hand[i][0] for i in range(5)}` is equal to the set `{10, 'J', 'Q', 'K', 'A'}` or however it is that you represent your cards – Frank Yellin Dec 08 '21 at 02:16

0 Answers0