daily pastebin goal
46%
SHARE
TWEET

Untitled

a guest Mar 19th, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import random
  2.  
  3. def print_kart():
  4.     for i in range(c):
  5.         print(i, end='   ')
  6.     print()
  7.     for i in my_kart:
  8.         print(i, end='  ')
  9.     print()
  10.  
  11. my_kart = ['7p', '7b', '8k', '8c', '9p', '9b', '10k', '10c', 'Jp', 'Jb', 'Qk', 'Qc', 'Kp', 'Kb', 'Ak', 'Ac']
  12. computer_kart = ['7c', '7k', '8b', '8p', '9c', '9k', '10b', '10p', 'Jk', 'Jc', 'Qp', 'Qb', 'Kc', 'Kk', 'Ap', 'Ab']
  13.  
  14. c = 16
  15. my_index = 0
  16. computer_index = 0
  17. temp_str = ''         #00000
  18. temp_arr = []         #00000
  19. my_a = ''                #00000
  20. my_b = ''                #00000
  21. computer_a = ''
  22. computer_b = ''
  23. temp_arr_my = []
  24.  
  25. print_kart()
  26. my_index = int(input())
  27. print(my_kart[my_index])
  28. temp_str = my_kart[my_index]
  29. temp_str_len = len(temp_str)
  30. if temp_str_len == 3:
  31.     my_a = temp_str[0]
  32.     my_b = temp_str[2]
  33. else:
  34.     my_a = temp_str[0]
  35.     my_b = temp_str[1]
  36. del my_kart[my_index]
  37. c -= 1
  38.  
  39. while True:
  40.     for i in computer_kart:
  41.         if my_a in i or my_b in i:
  42.             temp_arr.append(i)
  43.         # здесь делаем выход если не будет карт
  44.     if not temp_arr:
  45.         print('Вы победили!')
  46.         break
  47.     p = random.choice(temp_arr)
  48.     p_len = len(p)
  49.     if p_len == 3:
  50.         computer_a = p[0]
  51.         computer_b = p[2]
  52.     else:
  53.         computer_a = p[0]
  54.         computer_b = p[1]
  55.     print(p)
  56.     computer_kart.remove(p)
  57.     temp_arr = []
  58.     temp_str = ''
  59.     my_a = ''
  60.     my_b = ''
  61.     for i in my_kart:
  62.         if computer_a in i or computer_b in i:
  63.             temp_arr_my.append(i)
  64.     if not temp_arr_my:
  65.         print('Компьютер победил:')
  66.         break
  67.     while True:
  68.         print_kart()
  69.         my_index = int(input())
  70.         if computer_a in my_kart[my_index] or computer_b in my_kart[my_index]:
  71.             print(my_kart[my_index])
  72.             break
  73.         else:
  74.             print('Не мухлюйте!!!')
  75.     temp_str = my_kart[my_index]
  76.     temp_str_len = len(temp_str)
  77.     if temp_str_len == 3:
  78.         my_a = temp_str[0]
  79.         my_b = temp_str[2]
  80.     else:
  81.         my_a = temp_str[0]
  82.         my_b = temp_str[1]
  83.     del my_kart[my_index]
  84.     c -= 1
  85.     computer_a = ''
  86.     computer_b = ''
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top