Advertisement
Guest User

ochko

a guest
Apr 22nd, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.77 KB | None | 0 0
  1. import random
  2. state=("проиграли", "победили")
  3. score= random.randint(4,20)
  4. scoreBot= random.randint(4,20)
  5. class Game:
  6.  isWin = 0
  7.  def getCard(self):
  8.   return random.randint(2,10)
  9.  def AI(self):
  10.   if scoreBot<19: scoreBot+=getCard()
  11.  def getResult(self):
  12.   if score>scoreBot: isWin=1
  13.   else: isWin=0
  14.   if score>21: win=0
  15.   print("У противника ",scoreBot," очков, у вас ", score)
  16.   print("Вы ", state[isWin])
  17.   print("-------------")
  18. game=Game()
  19. choose =''
  20. while choose !='e':
  21.  if score>21:  game.getResult()
  22.  print("У вас ", score," очков.")
  23.  choose=input("взять карту? (+)")
  24.  if choose=='+':
  25.   score+=game.getCard()
  26.  else:
  27.   game.getResult()
  28.   score=random.randint(4, 20)
  29.   scoreBot=random.randint(4, 20)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement