def cards_ranking(
    My_Card,
    board_list=None
):  # screenshot va be cheat sheet e pair functions ezafe shavad
    """
    Ranks: 1,...,6
    It does not return None at all. 
    This is an independant function and it does not have any True or False function
    1: (12, [9,8,5]). 1: (12, [12,11,10]). 1: (12, [12,12,10]). 1: (5, []) 
    2: (10, [12,10,7]). 4: (5, [12,10,7]). 6: (3, [12,11,7,6,5])
    """
    if board_list == None:
        board_list = board_cards_list()[:]
    if board_list == []:
        return 1

    board_list = [n(i) for i in board_list]

    My_Card = n(My_Card)

    board_list = list(set(board_list))
    board_list.sort(reverse=True)
    Cards_Ranking = 1
    for i in range(len(board_list)):
        if My_Card >= board_list[i]:
            return Cards_Ranking
        else:
            Cards_Ranking = Cards_Ranking + 1
    return Cards_Ranking
Esempio n. 2
0
def is_there_any_better_possible_1_card_straight_on_table(board_list=None) : # screen shot again with these new Edition and discriptoins
    """
    returns True or False only.
    Table_str_1_cards must be True to return True.

    is_there_any_better_possible_1_card_straight_on_table() == True ;Me_str_2_cards_Ranking == 2 :
    ([7, 8, 9,  11, 12], 5, 6) ; ([5, 8, 9,  11, 12], 6, 7) ; ([6, 8, 9,  11, 12], 5, 7) 
    ([7, 8, 9,  11], 5, 6)
    is_there_any_better_possible_1_card_straight_on_table() == True ;Me_str_2_cards_Ranking == 1 :
    ([9, 10, 11,  13, 14], 7, 8) ; ([7, 10, 11,  13, 14], 8, 9) ; ([8, 10, 11,  13, 14], 7, 9)
    ([10, 11, 12,  14], 8, 9)
    if Table_str_1_cards() is True, Me_str_2_cards_Ranking == 3 is not possible 
    if Me_str_2_cards == True and Table_str_1_cards == True, automatically my higher card get lower or higher than str_1_Cards_list()[0]

    if Me_str_1_cards_Ranking == 2 or i'm not straight ,it will return True :
    False: ([7, 8, 9, 10], 2, 11). True: ([7, 8, 9, 10], 2, 6). True: ([7, 8, 9, 10], 2, 3). 

    This function common usage is: (Me_str_2_cards() and is_there_any_better_possible_1_card_straight_on_table()) means my 2 cards straight is not good.
    """
    
    if board_list == None :
        board_list = board_cards_list()[:]
    if board_list == []:
        return False
        
    if Table_str_1_cards( board_list ) == False :
        return False
    elif Me_str_1_cards_Ranking( board_list , c.my_1th_card , c.my_2th_card ) == 1 : 
        return False 
    elif Me_str_2_cards( board_list , c.my_1th_card , c.my_2th_card ) == False :
        return True
    elif max(c.my_1th_card,c.my_2th_card) < str_1_Cards_list( board_list )[0] : #equal is not possible
        return True
    else :
        return False
def Me_3_of_kinds_Ranking(board_list=None):
    """
    Best Rank: (1, 14) Example: ([5,6,6,8],6 ,14 )
    second index is my Kicker card
    First index rank: 1,2
    First index at Table_full_house or Table_1_pair is: Always 1
    First index at Table_2_pair first index is: 1,2. At Table_2_pair second index will be returned but not usable.
    """

    if board_list == None:
        board_list = board_cards_list()[:]
    if board_list == []:
        return None

    if Me_3_of_kinds(board_list) == True:

        board_list = [n(i) for i in board_list]
        board_list.sort(reverse=True)

        if board_list.count(n(c.my_1th_card)) == 2:
            My_Card = c.my_1th_card
            My_Kicker = c.my_2th_card
        elif board_list.count(n(c.my_2th_card)) == 2:
            My_Card = c.my_2th_card
            My_Kicker = c.my_2th_card

        Card = []
        for i in range(len(board_list)):
            if board_list.count(
                    board_list[i]) == 2 and board_list[i] not in Card:
                Card.append(board_list[i])
        Card.sort(reverse=True)

        return (Cards_Matching(Card, My_Card), n(My_Kicker))
def Me_Individual_Ranking(board_list=None):
    """
    Ranks :1,...,9
    1: ([14,13,5,4,3],12,8).  2: ([14,14,5,4,3],12,8)
    """

    if board_list == None:
        board_list = board_cards_list()[:]
    if board_list == []:
        return None

    if Me_Individual(board_list) == True:

        board_list = [n(i) for i in board_list]
        board_list.sort(reverse=True)

        My_Card = max(c.my_1th_card, c.my_2th_card)
        rank = 1
        for i in range(14, 1, -1):
            if i == My_Card:
                break
            elif i in board_list:
                continue
            rank += 1

        return rank
Esempio n. 5
0
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_pocket_pair_Ranking(board_list=None):
    """
    Ranks :1,2,3,4,5,6
    1 :([14,14,6,5,4],9,9) or ([14,14,14,5,4],9,9)
    6 :([14,13,9,8,7],4,4)
    """

    if board_list == None:
        board_list = board_cards_list()[:]
    if board_list == []:
        return None

    if Me_pocket_pair(board_list) == True:

        board_list = [n(i) for i in board_list]
        board_list.sort(reverse=True)

        board_list = [i for i in board_list if board_list.count(i) == 1]
        My_Card = c.my_1th_card
        rank = 1
        for i in range(14, 1, -1):
            if i == My_Card:
                break
            elif i in board_list:
                rank += 1

        return rank
Esempio n. 7
0
def Me_str_1_cards_Ranking(board_list=None) :
    """
    Rank 1,2 & None
    None if Me_str_2_cards == True or Me_str == False
    1 ( [7,8,9,11] , 10, 2 ) or ([7, 8, 9, 11], 10, 6).  2 ( [7,8,9,10] , 6, 2 )
    """
    
    if board_list == None :
        board_list = board_cards_list()[:]
    if board_list == []:
        return None

    if Me_str_2_cards( board_list ) == True :
        return None
    
    rank = 0
    for i in str_1_Cards_list( board_list ) :
        rank += 1
        if n(c.my_1th_card) == i or n(c.my_2th_card) == i :
            return rank
        if n(c.my_1th_card) == 14 :
            if 1 == i or n(c.my_2th_card) == i :
                return rank
        if n(c.my_2th_card) == 14 :
            if n(c.my_1th_card) == i or 1 == i :
                return rank    
def Me_1_pair_Ranking(board_list=None):
    """
    Best Rank: (1, 14) Example: ([10,8,2,5],14,10)
    second index is my Kicker card
    ([14,14,10,8,5],10,11): (1, 11)
    """

    if board_list == None:
        board_list = board_cards_list()[:]
    if board_list == []:
        return None

    if Me_1_pair(board_list) == True:

        board_list = [n(i) for i in board_list]
        board_list.sort(reverse=True)

        board_list = [i for i in board_list if board_list.count(i) == 1]
        if board_list.count(n(c.my_1th_card)) == 1:
            My_Card = c.my_1th_card
            My_Kicker = c.my_2th_card
        elif board_list.count(n(c.my_2th_card)) == 1:
            My_Card = c.my_2th_card
            My_Kicker = c.my_1th_card

        return (Cards_Matching(board_list, My_Card), n(My_Kicker))
Esempio n. 9
0
def Table_str_1_cards_Number(board_list=None) :
    """ Min Number is 0 if Table_str_1_cards == Flase, Max Number is 2 """
    if board_list == None :
        board_list = board_cards_list()[:]
    if board_list == []:
        return 0

    return len(str_1_Cards_list( board_list )) 
def Me_full_house_Ranking(board_list=None):
    """
    Ranks: 1,2,3,4
    Table_2_pair : 1 ([4,4,10,7,7],10,7) or ([4,10,10,7,7],10,4).  2 ([7,10,10,4,4],10,4).  4 ([4,4,10,7,7],4,10).
    Table_1_pair : depends on 2 same cards Ranking not 3 same cards ranking.
    Table_1_pair : 1 ( [2,3,5,5,6] , 5 , 6 ) .  2 ( [2,3,5,5,6] , 5 , 3 ).  3 ( [2,3,5,5,6] , 5 , 2 )
    """

    if board_list == None:
        board_list = board_cards_list()[:]
    if board_list == []:
        return None

    if Me_full_house(board_list) == True:

        board_list = [n(i) for i in board_list]
        board_list.sort(reverse=True)

        if Table_2_pair(board_list):

            Card = []
            for i in range(len(board_list)):
                if board_list.count(
                        board_list[i]) == 2 and board_list[i] not in Card:
                    Card.append(board_list[i])
            Card.sort(reverse=True)

            if Card[0] not in (n(c.my_1th_card), n(c.my_2th_card)):
                return 4  # very rare
            else:
                if Card[1] not in (n(c.my_1th_card), n(
                        c.my_2th_card)) and Card[1] != min(board_list):
                    return 1
                if (n(c.my_1th_card)) != Card[0]: My_Card = c.my_1th_card
                if (n(c.my_2th_card)) != Card[0]: My_Card = c.my_2th_card
                Card2 = []
                for i in (board_list):
                    if Card[0] == i or i in Card2:
                        continue
                    else:
                        Card2.append(i)
                return Cards_Matching(Card2, My_Card)

        if board_list.count(n(c.my_1th_card)) == 1:
            My_Card = c.my_1th_card
        elif board_list.count(n(c.my_2th_card)) == 1:
            My_Card = c.my_2th_card

        Card = []
        for i in range(len(board_list)):
            if board_list.count(board_list[i]) == 1:
                Card.append(board_list[i])
        Card.sort(reverse=True)

        return Cards_Matching(Card, My_Card)
Esempio n. 11
0
def Table_str_2_cards_Number(board_list=None) : 
    """
    Min Number is 0 if Table_str_2_cards== False, Max Number is 3 .
    At River just 30% it happens to be 0 for both Table_str_1_ and Table_str_2 at the same time.
    """
    if board_list == None :
        board_list = board_cards_list()[:]
    if board_list == []:
        return 0

    return len(str_2_Cards_list( board_list )) 
Esempio n. 12
0
def Table_Flush(board_list=None) :
    """ if Table_Flush_3_cards( board_list ) or Table_Flush_4_cards( board_list ) or Table_Flush_5_cards( board_list ) """
    
    if board_list == None :
        board_list = board_cards_list()[:]
    if board_list == []:
        return False
        
    if Table_Flush_3_cards( board_list ) or Table_Flush_4_cards( board_list ) or Table_Flush_5_cards( board_list ) :
        return True
    return False
Esempio n. 13
0
def Me_Flush(board_list=None) :
    """ if Me_Flush_by_3_table_cards or Me_Flush_by_4_table_cards or Me_Flush_by_5_table_cards """
    
    if board_list == None :
        board_list = board_cards_list()[:]
    if board_list == []:
        return False
        
    if Me_Flush_by_3_table_cards( board_list ) or Me_Flush_by_4_table_cards( board_list ) or Me_Flush_by_5_table_cards( board_list ) :
        return True
    else:
        return False
def Table_Individual_Cards_List(board_list=None):
    """ [7,7,5,10] returns [10, 5]"""

    if board_list == None:
        board_list = board_cards_list()[:]
    if board_list == []:
        return []

    board_list = [n(i) for i in board_list]
    Individual_Cards = [i for i in board_list if board_list.count(i) == 1]
    Individual_Cards.sort(reverse=True)
    return Individual_Cards
Esempio n. 15
0
def Table_str_2_cards(board_list=None) :
    """ Only Table_str_1_cards and Table_str_2_cards Functions can be True at the same time """    
    
    if board_list == None :
        board_list = board_cards_list()[:]
    if board_list == []:
        return False

    if len(str_2_Cards_list( board_list )) == 0 :
        return False
    else :
        return True
Esempio n. 16
0
def Me_str(board_list=None) : 
    """ if Me_str_2_cards or Me_str_1_cards """
    
    if board_list == None :
        board_list = board_cards_list()[:]
    if board_list == []:
        return False
        
    if Me_str_2_cards( board_list ) == True or Me_str_1_cards( board_list ) == True :
        return True
    else:
        return False
Esempio n. 17
0
def Table_str_5_cards(board_list=None):
    """ At River happens. returns True or False """
    if board_list == None :
        board_list = board_cards_list()[:]
    if board_list == []:
        return False

    if 14 in board_list :
        board_list.append(1)
    if str_length( board_list ) == 5:
        return True
    else :
        return False
def Me_2_pair(board_list=None):

    if board_list == None:
        board_list = board_cards_list()[:]
    if board_list == []:
        return False

    board_list = [n(i) for i in board_list]

    if board_list.count(n(c.my_1th_card)) == 1 and board_list.count(
            n(c.my_2th_card)) == 1 and n(c.my_1th_card) != n(c.my_2th_card):
        return True
    else:
        return False
def Me_pocket_4_of_kinds(board_list=None):

    if board_list == None:
        board_list = board_cards_list()[:]
    if board_list == []:
        return False

    board_list = [n(i) for i in board_list]

    if board_list.count(n(c.my_1th_card)) == 2 and board_list.count(
            n(c.my_2th_card)) == 2 and n(c.my_1th_card) == n(c.my_2th_card):
        return True
    else:
        return False
def Me_pocket_full_house(board_list=None):

    if board_list == None:
        board_list = board_cards_list()[:]
    if board_list == []:
        return False

    board_list = [n(i) for i in board_list]

    if board_list.count( n(c.my_1th_card) ) == 1 and board_list.count( n(c.my_2th_card) ) == 1 and n(c.my_1th_card) == n(c.my_2th_card) \
       and ( Table_1_pair( board_list ) or Table_2_pair( board_list ) or Table_3_of_kinds( board_list ) ):
        return True
    else:
        return False
def Me_full_house(board_list=None):

    if board_list == None:
        board_list = board_cards_list()[:]
    if board_list == []:
        return False

    board_list = [n(i) for i in board_list]

    if ( (board_list.count( n(c.my_1th_card) ) == 2 and 1 <= board_list.count( n(c.my_2th_card) ) <= 2)\
       or (1 <= board_list.count( n(c.my_1th_card) ) <= 2 and board_list.count( n(c.my_2th_card) ) == 2) ) and n(c.my_1th_card) != n(c.my_2th_card) :
        return True
    else:
        return False
def Me_3_of_kinds(board_list=None):

    if board_list == None:
        board_list = board_cards_list()[:]
    if board_list == []:
        return False

    board_list = [n(i) for i in board_list]

    if (board_list.count( n(c.my_1th_card) ) == 2 and board_list.count( n(c.my_2th_card) ) == 0) \
       or (board_list.count( n(c.my_1th_card) ) == 0 and board_list.count( n(c.my_2th_card) ) == 2):
        return True
    else:
        return False
Esempio n. 23
0
def Table_str_1_cards(board_list=None) :
    """
    Only Table_str_1_cards and Table_str_2_cards Functions can be True at the same time
    At River just 30% it happens to be False for both Table_str_1_ and Table_str_2 at the same time.
    """

    if board_list == None :
        board_list = board_cards_list()[:]
    if board_list == []:
        return False

    if len(str_1_Cards_list( board_list )) == 0 :
        return False
    else :
        return True
Esempio n. 24
0
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 Table_2_same_Cards_List(board_list=None):
    """ [7,7,5,5,6] returns [7, 5]"""

    if board_list == None:
        board_list = board_cards_list()[:]
    if board_list == []:
        return []

    board_list = [n(i) for i in board_list]

    Table_2_same_Cards = []
    for i in board_list:
        if board_list.count(i) == 2 and i not in Table_2_same_Cards:
            Table_2_same_Cards.append(i)
    Table_2_same_Cards.sort(reverse=True)
    return Table_2_same_Cards
def Me_pocket_3_of_kinds(board_list=None):

    if board_list == None:
        board_list = board_cards_list()[:]
    if board_list == []:
        return False

    board_list = [n(i) for i in board_list]

    if board_list.count(n(c.my_1th_card)) == 1 and board_list.count(
            n(c.my_2th_card)) == 1 and n(c.my_1th_card) == n(
                c.my_2th_card) and (Table_Individual(board_list)
                                    or Table_4_of_kinds(board_list)):
        return True
    else:
        return False
Esempio n. 27
0
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_4_same_Cards_List(board_list=None):
    """ [] or max one index"""

    if board_list == None:
        board_list = board_cards_list()[:]
    if board_list == []:
        return []

    board_list = [n(i) for i in board_list]

    Table_4_same_Cards = []
    for i in board_list:
        if board_list.count(i) == 4 and i not in Table_4_same_Cards:
            Table_4_same_Cards.append(i)
    Table_4_same_Cards.sort(reverse=True)
    return Table_4_same_Cards
def Table_Individual(board_list=None):

    if board_list == None:
        board_list = board_cards_list()[:]
    if board_list == []:
        return False

    board_list = [n(i) for i in board_list]

    pair_list = []
    for i in range(2, 15):
        if board_list.count(i) >= 2:
            pair_list.append(board_list.count(i))
    if len(pair_list) == 0:
        return True
    else:
        return False
Esempio n. 30
0
def Me_Open_str_draw_1_cards_Ranking(board_list=None) :
    """ Rank 1,2 & None """
    
    if board_list == None :
        board_list = board_cards_list()[:]
    if board_list == []:
        return None
        
    if Me_Open_str_draw_2_cards( board_list ) == True \
       or Me_str_2_cards( board_list ) == True :
        return None
    
    rank = 0
    for i in open_str_draw_1_Cards_list( board_list ) :
        rank += 1
        if n(c.my_1th_card) == i or n(c.my_2th_card) == i :
            return rank