Para la estructura del juego de cartas no explosivo en el propietario

importar numpy como np 
 importar aleatorio como aleatorio
 # gamer1 / gamer2 / gamer3 Especificado aleatoriamente, esto es más importante 
# 
Grupo de cartas de construcción pool_1 = list (range (1,14 )) 
pool = np.repeat (pool_1,4 ) .tolist () 
pool.append ( 14 ) 
pool.append ( 15 ) 
random.shuffle (pool) 

gamer1 = pool [0:17 ] 

gamer2 = pool [17:34 ] 
gamer3 = pool [34:51 ] 
n = 0 
boom1 = np.array (np.unique (gamer1, return_counts = True)) 
n1 = boom1 [0, (np.where (boom1 [1,] == 4 ))]
boom2= np.array (np.unique (gamer2, return_counts = True)) 
n2 = boom2 [0, (np.where (boom2 [1,] == 4 ))] 
boom3 = np.array (np.unique (gamer3, return_counts = True)) 
n3 = boom3 [0, (np.where (boom3 [1,] == 4 ))] 
booms = len (n1 [0,]) + len (n2 [0,]) + len (n3 [0,])
 if 14 y 15 in (gamer1): 
    booms = booms + 1
 elif 14 y 15 in (gamer1): 
    booms = booms + 1
 elif 14 y 15 in (gamer1): 
    booms = booms + 1
otra cosa :
     pase 
de impresión (brazos)
 si booms == 0:
     pasan 
otra cosa :
     mientras booms> 1 y n <1000 : 
        piscina = np.repeat (pool_1,4 ) .tolist () 
        random.shuffle (piscina) 
        gamer1 = animales [0 : 17 ] 
        jugador2 = grupo [17:34 ] 
        jugador3 = grupo [34:51 ] 
        boom1 = np.unique (gamer1, return_counts = True) 
        boom2 = np.unique (gamer2, return_counts = True) 
        boom3= np.unique (gamer3, return_counts = True) 
        boom = boom1 + boom2 + boom3 
        n = n + 1 
gamer1.sort () 
gamer2.sort () 
gamer3.sort () 
# 底牌 中 的 牌
para c_1 en gamer1: 
    pool.remove (c_1) 
para c_2 en gamer2: 
    pool.remove (c_2) 
para c_3 en gamer3: 
    pool.remove (c_3) 
# print (gamer1, len (gamer1)) 
# print (gamer2, len (gamer2)) 
# print (gamer3, len (gamer3)) 
# print (pool) 

deftrans_card (loser_1, winer_1, norm_er): 
    pool_dict = { " 0 " : 12, " 1 " : 12, " 2 " : 12, " 3 " : 12, " 4 " : 13, " 5 " : 13, " 6 " : 13, " 7 " : 13, " 8 " : 1, " 9 " : 1, " 10 " : 1, "11 " : 1, " 12" : 2, " 13 " : 2, " 14 " : 2, " 15 " : 2, " 16 " : 3, " 17 " : 3, " 18 " : 3, " 19 " : 3, " 20 " : 4, " 21 " : 4, " 22 " : 4, " 23 " : 4, " 24 " : 5, "25 " : 5 " 26" : 5 ,
                  " 27 " : 5, " 28 " : 6, " 29 " : 6, " 30 " : 6, " 31 " : 6, " 32 " : 7, " 33 " : 7, " 34 " : 7, " 35 " : 7, " 36 " : 8, " 37 " : 8, " 38 " : 8," 39 " : 8," 40 " : 9, " 41 " : 9, " 42 " : 9, " 43 " : 9, " 44 " : 10, " 45 " : 10, " 46 " : 10, " 47 " : 10, " 48 " : 11, " 49 " : 11, " 50 " : 11, " 51 " : 11, " 52 ": 14, " 53 ": 15 } 
    key_list = [] 
    value_list = []
     para key, valor en pool_dict.items (): 
        key_list.append (key) 
        value_list.append (value) 
    loser_card = []
     para número en loser_1: 
        index_mid = value_list.index (número ) 
        add_card = key_list [index_mid] 
        add_card = int (add_card) 
        value_list.pop (index_mid) 
        key_list.pop (index_mid) 
        loser_card.append (add_card) 
    winer_card = []
    para number1 en winer_1: 
        index_mid = value_list.index (number1) 
        add_card = key_list [index_mid] 
        add_card = int (add_card) 
        value_list.pop (index_mid) 
        key_list.pop (index_mid) 
        winer_card.append (add_card) 
    norm_card = []
     para number2 en norma_er: 
        index_mid = value_list.index (number2) 
        add_card = key_list [index_mid] 
        add_card = int (add_card) 
        value_list.pop (index_mid) 
        key_list.pop (index_mid) 
        norm_card.append (add_card) 
    para pt en (loser_card, winer_card, norm_card):
         print (pt) 
trans_card (gamer1, gamer2, gamer3)

 

Supongo que te gusta

Origin www.cnblogs.com/yuvejxke/p/12674895.html
Recomendado
Clasificación