How do I logically check for a royal flush in poker?

Viewed 35

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?

0 Answers
Related