daily pastebin goal
19%
SHARE
TWEET

Untitled

a guest Mar 19th, 2019 57 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.     if not my_kart and not computer_kart:
  41.         print('Ничья!')
  42.         break
  43.     for i in computer_kart:
  44.         if my_a in i or my_b in i:
  45.             temp_arr.append(i)
  46.         # здесь делаем выход если не будет карт
  47.     if not temp_arr:
  48.         print('Вы победили!')
  49.         break
  50.     p = random.choice(temp_arr)
  51.     p_len = len(p)
  52.     if p_len == 3:
  53.         computer_a = p[0]
  54.         computer_b = p[2]
  55.     else:
  56.         computer_a = p[0]
  57.         computer_b = p[1]
  58.     print(p)
  59.     computer_kart.remove(p)
  60.     temp_arr = []
  61.     temp_str = ''
  62.     my_a = ''
  63.     my_b = ''
  64.     for i in my_kart:
  65.         if computer_a in i or computer_b in i:
  66.             temp_arr_my.append(i)
  67.     if not temp_arr_my:
  68.         print('Компьютер победил:')
  69.         break
  70.     temp_arr_my = []
  71.     while True:
  72.         print_kart()
  73.         my_index = int(input())
  74.         if computer_a in my_kart[my_index] or computer_b in my_kart[my_index]:
  75.             print(my_kart[my_index])
  76.             break
  77.         else:
  78.             print('Не мухлюйте!!!')
  79.     temp_str = my_kart[my_index]
  80.     temp_str_len = len(temp_str)
  81.     if temp_str_len == 3:
  82.         my_a = temp_str[0]
  83.         my_b = temp_str[2]
  84.     else:
  85.         my_a = temp_str[0]
  86.         my_b = temp_str[1]
  87.     del my_kart[my_index]
  88.     c -= 1
  89.     computer_a = ''
  90.     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