def Table_Flush_5_cards(List=None): global flop_stage , turn_stage , river_stage ,\ board_card_1th , board_card_2th , board_card_3th , board_card_4th , board_card_5th load_variables() if List == None: if flop_stage == True and turn_stage == False: List = [board_card_1th, board_card_2th, board_card_3th] elif turn_stage == True and river_stage == False: List = [ board_card_1th, board_card_2th, board_card_3th, board_card_4th ] elif river_stage == True: List = [ board_card_1th, board_card_2th, board_card_3th, board_card_4th, board_card_5th ] c = 0 d = 0 h = 0 sp = 0 for i in List: if s(i) == "c": c = c + 1 if s(i) == "d": d = d + 1 if s(i) == "h": h = h + 1 if s(i) == "s": sp = sp + 1 if 5 in (c, d, h, sp): return True return False
def Me_Flush_by_5_table_cards(board_list=None) : """ ( ['6 c','8 c','10 c','K c','A c'] , '2 c' , '3 c' ) return False ( ['6 c','8 c','10 c','K c','A c'] , 'Q c' , '7 c' ) return True """ if board_list == None : board_list = board_cards_list()[:] if board_list == []: return False sign1 = 0 sign2 = 0 for i in board_list : if s(config.my_1th_card) == s(i) : sign1 += 1 if s(config.my_2th_card) == s(i) : sign2 += 1 if sign1 == 5 and sign2 == 5: My_highest = max(n(config.my_1th_card),n(config.my_2th_card)) elif sign1 == 5 : My_highest = n(config.my_1th_card) elif sign2 == 5 : My_highest = n(config.my_2th_card) sign_List = [] for i in board_list : sign_List.append(n(i)) if (sign1 == 5 or sign2 == 5) and My_highest > min(sign_List) : return True return False
def Me_Flush_by_4_table_cards(List=None): """ ( ['6 c','8 c','10 c','K c','A c'] , 'Q c' , '3 c' ) return False """ global flop_stage , turn_stage , river_stage ,\ board_card_1th , board_card_2th , board_card_3th , board_card_4th , board_card_5th , my_1th_card , my_2th_card load_variables() if List == None: if flop_stage == True and turn_stage == False: List = [board_card_1th, board_card_2th, board_card_3th] elif turn_stage == True and river_stage == False: List = [ board_card_1th, board_card_2th, board_card_3th, board_card_4th ] elif river_stage == True: List = [ board_card_1th, board_card_2th, board_card_3th, board_card_4th, board_card_5th ] sign1 = 0 sign2 = 0 for i in List: if s(my_1th_card) == s(i): sign1 += 1 if s(my_2th_card) == s(i): sign2 += 1 if sign1 == 4 or sign2 == 4: return True return False
def Me_Flush_by_4_table_cards(List=None): """ ( ['6 c','8 c','10 c','K c','A c'] , 'Q c' , '3 c' ) return False """ if List == None: if c.flop_stage == True and c.turn_stage == False: List = [c.board_card_1th, c.board_card_2th, c.board_card_3th] elif c.turn_stage == True and c.river_stage == False: List = [ c.board_card_1th, c.board_card_2th, c.board_card_3th, c.board_card_4th ] elif c.river_stage == True: List = [ c.board_card_1th, c.board_card_2th, c.board_card_3th, c.board_card_4th, c.board_card_5th ] sign1 = 0 sign2 = 0 for i in List: if s(c.my_1th_card) == s(i): sign1 += 1 if s(c.my_2th_card) == s(i): sign2 += 1 if sign1 == 4 or sign2 == 4: return True return False
def Me_Flush_by_3_table_cards(List=None): """ ( ['6 c','8 c','10 c','K c','A d'] , '2 c' , '3 c' ) return False """ if List == None: if c.flop_stage == True and c.turn_stage == False: List = [c.board_card_1th, c.board_card_2th, c.board_card_3th] elif c.turn_stage == True and c.river_stage == False: List = [ c.board_card_1th, c.board_card_2th, c.board_card_3th, c.board_card_4th ] elif c.river_stage == True: List = [ c.board_card_1th, c.board_card_2th, c.board_card_3th, c.board_card_4th, c.board_card_5th ] if s(c.my_1th_card) == s(c.my_2th_card): sign = 0 for i in List: if s(c.my_1th_card) == s(i): sign += 1 if sign == 3: return True return False
def Me_Flush_draw_by_2_table_cards(List=None): global flop_stage , turn_stage , river_stage ,\ board_card_1th , board_card_2th , board_card_3th , board_card_4th , board_card_5th , my_1th_card , my_2th_card load_variables() if List == None: if flop_stage == True and turn_stage == False: List = [board_card_1th, board_card_2th, board_card_3th] elif turn_stage == True and river_stage == False: List = [ board_card_1th, board_card_2th, board_card_3th, board_card_4th ] elif river_stage == True: List = [ board_card_1th, board_card_2th, board_card_3th, board_card_4th, board_card_5th ] if s(my_1th_card) == s(my_2th_card) and len(List) <= 4: sign = 0 for i in List: if s(my_1th_card) == s(i): sign += 1 if sign == 2: return True return False
def Table_Flush_5_cards(List=None): if List == None: if c.flop_stage == True and c.turn_stage == False: List = [c.board_card_1th, c.board_card_2th, c.board_card_3th] elif c.turn_stage == True and c.river_stage == False: List = [ c.board_card_1th, c.board_card_2th, c.board_card_3th, c.board_card_4th ] elif c.river_stage == True: List = [ c.board_card_1th, c.board_card_2th, c.board_card_3th, c.board_card_4th, c.board_card_5th ] c = 0 d = 0 h = 0 sp = 0 for i in List: if s(i) == "c": c = c + 1 if s(i) == "d": d = d + 1 if s(i) == "h": h = h + 1 if s(i) == "s": sp = sp + 1 if 5 in (c, d, h, sp): return True return False
def hand8(): """ AK,...,1010,...22,...,(65 rang) Blind position call 2 blind raise, otherwise fold that """ global my_1th_card, my_2th_card load_variables() if not (hand1() or hand2()): if hand3() or hand4() \ or hand5() or hand6() \ or ( n( my_1th_card ) >= 5 and n( my_2th_card ) >= 5 and \ s( my_1th_card ) == s( my_2th_card ) and abs( n( my_2th_card ) - n( my_1th_card ) ) == 1 ) : #shout("hand8 is True") return True else: return None
def hand7(): """ 72,73,...,96,107 (gheir rang) Fold small blind position (otherwise Small always call Blind) """ global my_1th_card, my_2th_card load_variables() if not( hand1() or hand2() or hand3() or \ hand4() or hand5() or hand6() \ or s( my_1th_card ) == s( my_2th_card ) ) : for i in range(2, 8): if i in ( n( my_1th_card ) , n( my_2th_card ) ) and abs( n( my_2th_card ) - n( my_1th_card ) ) >= 3 \ and n( my_1th_card ) <= 10 and n( my_2th_card ) <= 10 : #shout("hand7 is True") return True else: return None
def Me_Flush_draw_by_2_table_cards(board_list=None) : if board_list == None : board_list = board_cards_list()[:] if board_list == []: return False if s(config.my_1th_card) == s(config.my_2th_card) and len(board_list) <= 4 : sign = 0 for i in board_list : if s(config.my_1th_card) == s(i) : sign += 1 if sign == 2 : return True return False
def Me_Flush_by_3_table_cards(board_list=None) : """ ( ['6 c','8 c','10 c','K c','A d'] , '2 c' , '3 c' ) return False """ if board_list == None : board_list = board_cards_list()[:] if board_list == []: return False if s(config.my_1th_card) == s(config.my_2th_card) : sign = 0 for i in board_list : if s(config.my_1th_card) == s(i) : sign += 1 if sign == 3 : return True return False
def Table_Flush_5_cards(board_list=None) : if board_list == None : board_list = board_cards_list()[:] if board_list == []: return False c = 0; d = 0; h = 0; sp = 0 for i in board_list : if s(i) == "c" : c = c + 1 if s(i) == "d" : d = d + 1 if s(i) == "h" : h = h + 1 if s(i) == "s" : sp = sp + 1 if 5 in (c,d,h,sp) : return True return False
def change_hand_format(my_1th_card, my_2th_card): """ This function change the given hand format to the format used in the HOLDEM_169_HOLE_CARDS_RANKING_LIST Example: my_1th_card = ('Seven', 'Spade') ; my_2th_card = ('Ace', 'Heart') returns 'A7o' """ if n(my_1th_card) == 14: my_1th_card_value = 'A' elif n(my_1th_card) == 13: my_1th_card_value = 'K' elif n(my_1th_card) == 12: my_1th_card_value = 'Q' elif n(my_1th_card) == 11: my_1th_card_value = 'J' elif n(my_1th_card) == 10: my_1th_card_value = 'T' else: my_1th_card_value = str(n(my_1th_card)) if n(my_2th_card) == 14: my_2th_card_value = 'A' elif n(my_2th_card) == 13: my_2th_card_value = 'K' elif n(my_2th_card) == 12: my_2th_card_value = 'Q' elif n(my_2th_card) == 11: my_2th_card_value = 'J' elif n(my_2th_card) == 10: my_2th_card_value = 'T' else: my_2th_card_value = str(n(my_2th_card)) if n(my_1th_card) > n(my_2th_card): high_card = my_1th_card_value low_card = my_2th_card_value else: high_card = my_2th_card_value low_card = my_1th_card_value if n(my_1th_card) == n(my_2th_card): return '%s%s' % (my_1th_card_value, my_2th_card_value) elif s(my_1th_card) == s(my_2th_card): return '%s%ss' % (high_card, low_card) elif s(my_1th_card) != s(my_2th_card): return '%s%so' % (high_card, low_card)
def Me_Flush_by_4_table_cards(board_list=None) : """ ( ['6 c','8 c','10 c','K c','A c'] , 'Q c' , '3 c' ) return False """ if board_list == None : board_list = board_cards_list()[:] if board_list == []: return False sign1 = 0 sign2 = 0 for i in board_list : if s(config.my_1th_card) == s(i) : sign1 += 1 if s(config.my_2th_card) == s(i) : sign2 += 1 if sign1 == 4 or sign2 == 4 : return True return False
def Me_Flush_by_5_table_cards(List=None): """ ( ['6 c','8 c','10 c','K c','A c'] , '2 c' , '3 c' ) return False ( ['6 c','8 c','10 c','K c','A c'] , 'Q c' , '7 c' ) return True """ global flop_stage , turn_stage , river_stage ,\ board_card_1th , board_card_2th , board_card_3th , board_card_4th , board_card_5th , my_1th_card , my_2th_card load_variables() if List == None: if flop_stage == True and turn_stage == False: List = [board_card_1th, board_card_2th, board_card_3th] elif turn_stage == True and river_stage == False: List = [ board_card_1th, board_card_2th, board_card_3th, board_card_4th ] elif river_stage == True: List = [ board_card_1th, board_card_2th, board_card_3th, board_card_4th, board_card_5th ] sign1 = 0 sign2 = 0 for i in List: if s(my_1th_card) == s(i): sign1 += 1 if s(my_2th_card) == s(i): sign2 += 1 if sign1 == 5 and sign2 == 5: My_highest = max(n(my_1th_card), n(my_2th_card)) elif sign1 == 5: My_highest = n(my_1th_card) elif sign2 == 5: My_highest = n(my_2th_card) sign_List = [] for i in List: sign_List.append(n(i)) if (sign1 == 5 or sign2 == 5) and My_highest > min(sign_List): return True return False
def Me_Flush_draw_by_3_table_cards(List=None): if List == None: if c.flop_stage == True and c.turn_stage == False: List = [c.board_card_1th, c.board_card_2th, c.board_card_3th] elif c.turn_stage == True and c.river_stage == False: List = [ c.board_card_1th, c.board_card_2th, c.board_card_3th, c.board_card_4th ] elif c.river_stage == True: List = [ c.board_card_1th, c.board_card_2th, c.board_card_3th, c.board_card_4th, c.board_card_5th ] sign1 = 0 sign2 = 0 if s(c.my_1th_card) != s(c.my_2th_card) and len(List) <= 4: for i in List: if s(c.my_1th_card) == s(i): sign1 += 1 if s(c.my_2th_card) == s(i): sign2 += 1 if sign1 == 3 or sign2 == 3: return True return False
def Me_Flush_by_5_table_cards(List=None): """ ( ['6 c','8 c','10 c','K c','A c'] , '2 c' , '3 c' ) return False ( ['6 c','8 c','10 c','K c','A c'] , 'Q c' , '7 c' ) return True """ if List == None: if c.flop_stage == True and c.turn_stage == False: List = [c.board_card_1th, c.board_card_2th, c.board_card_3th] elif c.turn_stage == True and c.river_stage == False: List = [ c.board_card_1th, c.board_card_2th, c.board_card_3th, c.board_card_4th ] elif c.river_stage == True: List = [ c.board_card_1th, c.board_card_2th, c.board_card_3th, c.board_card_4th, c.board_card_5th ] sign1 = 0 sign2 = 0 for i in List: if s(c.my_1th_card) == s(i): sign1 += 1 if s(c.my_2th_card) == s(i): sign2 += 1 if sign1 == 5 and sign2 == 5: My_highest = max(n(c.my_1th_card), n(c.my_2th_card)) elif sign1 == 5: My_highest = n(c.my_1th_card) elif sign2 == 5: My_highest = n(c.my_2th_card) sign_List = [] for i in List: sign_List.append(n(i)) if (sign1 == 5 or sign2 == 5) and My_highest > min(sign_List): return True return False
def hand6(): """ KJ,QJ,,...,A2,...,(108,98 rang),109 1 Blind call """ global my_1th_card, my_2th_card load_variables() if n(my_1th_card) != n(my_2th_card): if hand5() != True: if 14 in [ n( my_1th_card ) , n( my_2th_card ) ] \ or ( n( my_1th_card ) >= 8 and n( my_2th_card ) >= 8 and s( my_1th_card ) == s( my_2th_card ) ) \ or ( n( my_1th_card ) >= 9 and n( my_2th_card ) >= 9 ) : #shout("hand6 is True") return True else: return None
def Table_Flush_draw(List=None): """ True if 2 same sign card availabe on the table(not more or less than 2) returns False on River """ global flop_stage , turn_stage , river_stage ,\ board_card_1th , board_card_2th , board_card_3th , board_card_4th , board_card_5th load_variables() if List == None: if flop_stage == True and turn_stage == False: List = [board_card_1th, board_card_2th, board_card_3th] elif turn_stage == True and river_stage == False: List = [ board_card_1th, board_card_2th, board_card_3th, board_card_4th ] elif river_stage == True: List = [ board_card_1th, board_card_2th, board_card_3th, board_card_4th, board_card_5th ] if len(List) > 4: return False c = 0 d = 0 h = 0 sp = 0 for i in List: if s(i) == "c": c = c + 1 if s(i) == "d": d = d + 1 if s(i) == "h": h = h + 1 if s(i) == "s": sp = sp + 1 if 2 in (c, d, h, sp): return True return False
def Me_Flush_draw_by_2_table_cards(List=None): if List == None: if c.flop_stage == True and c.turn_stage == False: List = [c.board_card_1th, c.board_card_2th, c.board_card_3th] elif c.turn_stage == True and c.river_stage == False: List = [ c.board_card_1th, c.board_card_2th, c.board_card_3th, c.board_card_4th ] elif c.river_stage == True: List = [ c.board_card_1th, c.board_card_2th, c.board_card_3th, c.board_card_4th, c.board_card_5th ] if s(c.my_1th_card) == s(c.my_2th_card) and len(List) <= 4: sign = 0 for i in List: if s(c.my_1th_card) == s(i): sign += 1 if sign == 2: return True return False
def Table_Flush_draw(board_list=None) : """ True if 2 same sign card availabe on the table(not more or less than 2) returns False on River """ if board_list == None : board_list = board_cards_list()[:] if board_list == []: return False if len(board_list) > 4 : return False c = 0; d = 0; h = 0; sp = 0 for i in board_list : if s(i) == "c" : c = c + 1 if s(i) == "d" : d = d + 1 if s(i) == "h" : h = h + 1 if s(i) == "s" : sp = sp + 1 if 2 in (c,d,h,sp) : return True return False
def Me_Flush_draw_by_3_table_cards(board_list=None) : if board_list == None : board_list = board_cards_list()[:] if board_list == []: return False sign1 = 0 sign2 = 0 if s(config.my_1th_card) != s(config.my_2th_card) and len(board_list) <= 4 : for i in board_list : if s(config.my_1th_card) == s(i) : sign1 += 1 if s(config.my_2th_card) == s(i) : sign2 += 1 if sign1 == 3 or sign2 == 3 : return True return False
def Me_Flush_draw_Ranking(board_list=None) : """ Rank 1,...,10 Example: Rank 2: ( ['6 c','K c','5 h'] , 'Q c' , '3 c' ) return None if Me_Flush == True or on River or not Me_Flush_draw """ if board_list == None : board_list = board_cards_list()[:] if board_list == []: return None if Me_Flush( board_list ) == True or len(board_list) == 5 \ or( Me_Flush_draw_by_2_table_cards( board_list ) == False and Me_Flush_draw_by_3_table_cards( board_list ) == False ) : return None c = 0; d = 0; h = 0; sp = 0 for i in board_list : if s(i) == "c" : c = c + 1 if s(i) == "d" : d = d + 1 if s(i) == "h" : h = h + 1 if s(i) == "s" : sp = sp + 1 sign_List = [] if c >= 2 : if s(config.my_1th_card) == s(config.my_2th_card) and s(config.my_1th_card) == "c" and c == 2: My_highest = max(n(config.my_1th_card),n(config.my_2th_card)) elif s(config.my_1th_card) == "c" and c == 3 : My_highest = n(config.my_1th_card) elif s(config.my_2th_card) == "c" and c == 3 : My_highest = n(config.my_2th_card) for i in board_list : if s(i) == "c" : sign_List.append(n(i)) elif d >= 2 : if s(config.my_1th_card) == s(config.my_2th_card) and s(config.my_1th_card) == "d" and d == 2: My_highest = max(n(config.my_1th_card),n(config.my_2th_card)) elif s(config.my_1th_card) == "d" and d == 3 : My_highest = n(config.my_1th_card) elif s(config.my_2th_card) == "d" and d == 3 : My_highest = n(config.my_2th_card) for i in board_list : if s(i) == "d" : sign_List.append(n(i)) elif h >= 2 : if s(config.my_1th_card) == s(config.my_2th_card) and s(config.my_1th_card) == "h" and h == 2: My_highest = max(n(config.my_1th_card),n(config.my_2th_card)) elif s(config.my_1th_card) == "h" and h == 3 : My_highest = n(config.my_1th_card) elif s(config.my_2th_card) == "h" and h == 3 : My_highest = n(config.my_2th_card) for i in board_list : if s(i) == "h" : sign_List.append(n(i)) elif sp >= 2 : if s(config.my_1th_card) == s(config.my_2th_card) and s(config.my_1th_card) == "s" and sp == 2: My_highest = max(n(config.my_1th_card),n(config.my_2th_card)) elif s(config.my_1th_card) == "s" and sp == 3 : My_highest = n(config.my_1th_card) elif s(config.my_2th_card) == "s" and sp == 3 : My_highest = n(config.my_2th_card) for i in board_list : if s(i) == "s" : sign_List.append(n(i)) sign_List.sort(reverse=True) rank = 1 for i in range(14,1,-1): if i == My_highest : break elif i in sign_List : continue rank += 1 return rank
def Me_Flush_draw_Ranking(List=None): """ Rank 1,...,10 Example: Rank 2: ( ['6 c','K c','5 h'] , 'Q c' , '3 c' ) return None if Me_Flush == True or on River or not Me_Flush_draw """ if List == None: if c.flop_stage == True and c.turn_stage == False: List = [c.board_card_1th, c.board_card_2th, c.board_card_3th] elif c.turn_stage == True and c.river_stage == False: List = [ c.board_card_1th, c.board_card_2th, c.board_card_3th, c.board_card_4th ] elif c.river_stage == True: List = [ c.board_card_1th, c.board_card_2th, c.board_card_3th, c.board_card_4th, c.board_card_5th ] if Me_Flush( List ) == True or len(List) == 5 \ or( Me_Flush_draw_by_2_table_cards( List ) == False and Me_Flush_draw_by_3_table_cards( List ) == False ) : return None c = 0 d = 0 h = 0 sp = 0 for i in List: if s(i) == "c": c = c + 1 if s(i) == "d": d = d + 1 if s(i) == "h": h = h + 1 if s(i) == "s": sp = sp + 1 sign_List = [] if c >= 2: if s(c.my_1th_card) == s(c.my_2th_card) and s( c.my_1th_card) == "c" and c == 2: My_highest = max(n(c.my_1th_card), n(c.my_2th_card)) elif s(c.my_1th_card) == "c" and c == 3: My_highest = n(c.my_1th_card) elif s(c.my_2th_card) == "c" and c == 3: My_highest = n(c.my_2th_card) for i in List: if s(i) == "c": sign_List.append(n(i)) elif d >= 2: if s(c.my_1th_card) == s(c.my_2th_card) and s( c.my_1th_card) == "d" and d == 2: My_highest = max(n(c.my_1th_card), n(c.my_2th_card)) elif s(c.my_1th_card) == "d" and d == 3: My_highest = n(c.my_1th_card) elif s(c.my_2th_card) == "d" and d == 3: My_highest = n(c.my_2th_card) for i in List: if s(i) == "d": sign_List.append(n(i)) elif h >= 2: if s(c.my_1th_card) == s(c.my_2th_card) and s( c.my_1th_card) == "h" and h == 2: My_highest = max(n(c.my_1th_card), n(c.my_2th_card)) elif s(c.my_1th_card) == "h" and h == 3: My_highest = n(c.my_1th_card) elif s(c.my_2th_card) == "h" and h == 3: My_highest = n(c.my_2th_card) for i in List: if s(i) == "h": sign_List.append(n(i)) elif sp >= 2: if s(c.my_1th_card) == s(c.my_2th_card) and s( c.my_1th_card) == "s" and sp == 2: My_highest = max(n(c.my_1th_card), n(c.my_2th_card)) elif s(c.my_1th_card) == "s" and sp == 3: My_highest = n(c.my_1th_card) elif s(c.my_2th_card) == "s" and sp == 3: My_highest = n(c.my_2th_card) for i in List: if s(i) == "s": sign_List.append(n(i)) sign_List.sort(reverse=True) rank = 1 for i in range(14, 1, -1): if i == My_highest: break elif i in sign_List: continue rank += 1 return rank
def Me_Flush_Ranking(List=None): """ Rank 1,...,9 Example: Rank 3: ( ['6 c','K c','5 c'] , 'J c' , '3 c' ) return None if Me_Flush_ == False """ if List == None: if c.flop_stage == True and c.turn_stage == False: List = [c.board_card_1th, c.board_card_2th, c.board_card_3th] elif c.turn_stage == True and c.river_stage == False: List = [ c.board_card_1th, c.board_card_2th, c.board_card_3th, c.board_card_4th ] elif c.river_stage == True: List = [ c.board_card_1th, c.board_card_2th, c.board_card_3th, c.board_card_4th, c.board_card_5th ] if Me_Flush(List) == False: return None c = 0 d = 0 h = 0 sp = 0 for i in List: if s(i) == "c": c = c + 1 if s(i) == "d": d = d + 1 if s(i) == "h": h = h + 1 if s(i) == "s": sp = sp + 1 sign_List = [] if c >= 3: if s(c.my_1th_card) == s(c.my_2th_card): My_highest = max(n(c.my_1th_card), n(c.my_2th_card)) elif s(c.my_1th_card) == "c": My_highest = n(c.my_1th_card) elif s(c.my_2th_card) == "c": My_highest = n(c.my_2th_card) for i in List: if s(i) == "c": sign_List.append(n(i)) elif d >= 3: if s(c.my_1th_card) == s(c.my_2th_card): My_highest = max(n(c.my_1th_card), n(c.my_2th_card)) elif s(c.my_1th_card) == "d": My_highest = n(c.my_1th_card) elif s(c.my_2th_card) == "d": My_highest = n(c.my_2th_card) for i in List: if s(i) == "d": sign_List.append(n(i)) elif h >= 3: if s(c.my_1th_card) == s(c.my_2th_card): My_highest = max(n(c.my_1th_card), n(c.my_2th_card)) elif s(c.my_1th_card) == "h": My_highest = n(c.my_1th_card) elif s(c.my_2th_card) == "h": My_highest = n(c.my_2th_card) for i in List: if s(i) == "h": sign_List.append(n(i)) elif sp >= 3: if s(c.my_1th_card) == s(c.my_2th_card): My_highest = max(n(c.my_1th_card), n(c.my_2th_card)) elif s(c.my_1th_card) == "s": My_highest = n(c.my_1th_card) elif s(c.my_2th_card) == "s": My_highest = n(c.my_2th_card) for i in List: if s(i) == "s": sign_List.append(n(i)) sign_List.sort(reverse=True) rank = 1 for i in range(14, 1, -1): if i == My_highest: break elif i in sign_List: continue rank += 1 return rank
def Me_Flush_Ranking(board_list=None) : """ Rank 1,...,9 Example: Rank 3: ( ['6 c','K c','5 c'] , 'J c' , '3 c' ) return None if Me_Flush_ == False """ if board_list == None : board_list = board_cards_list()[:] if board_list == []: return None if Me_Flush( board_list ) == False : return None c = 0; d = 0; h = 0; sp = 0 for i in board_list : if s(i) == "c" : c = c + 1 if s(i) == "d" : d = d + 1 if s(i) == "h" : h = h + 1 if s(i) == "s" : sp = sp + 1 sign_List = [] if c >= 3 : if s(config.my_1th_card) == s(config.my_2th_card) : My_highest = max(n(config.my_1th_card),n(config.my_2th_card)) elif s(config.my_1th_card) == "c" : My_highest = n(config.my_1th_card) elif s(config.my_2th_card) == "c" : My_highest = n(config.my_2th_card) for i in board_list : if s(i) == "c" : sign_List.append(n(i)) elif d >= 3 : if s(config.my_1th_card) == s(config.my_2th_card) : My_highest = max(n(config.my_1th_card),n(config.my_2th_card)) elif s(config.my_1th_card) == "d" : My_highest = n(config.my_1th_card) elif s(config.my_2th_card) == "d" : My_highest = n(config.my_2th_card) for i in board_list : if s(i) == "d" : sign_List.append(n(i)) elif h >= 3 : if s(config.my_1th_card) == s(config.my_2th_card) : My_highest = max(n(config.my_1th_card),n(config.my_2th_card)) elif s(config.my_1th_card) == "h" : My_highest = n(config.my_1th_card) elif s(config.my_2th_card) == "h" : My_highest = n(config.my_2th_card) for i in board_list : if s(i) == "h" : sign_List.append(n(i)) elif sp >= 3 : if s(config.my_1th_card) == s(config.my_2th_card) : My_highest = max(n(config.my_1th_card),n(config.my_2th_card)) elif s(config.my_1th_card) == "s" : My_highest = n(config.my_1th_card) elif s(config.my_2th_card) == "s" : My_highest = n(config.my_2th_card) for i in board_list : if s(i) == "s" : sign_List.append(n(i)) sign_List.sort(reverse=True) rank = 1 for i in range(14,1,-1): if i == My_highest : break elif i in sign_List : continue rank += 1 return rank