Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- def whoIsFirst():
- if random.randint == 0:
- return 'Игрок 1'
- else:
- return 'Игрок 2'
- def makeMove():
- move = ' '
- while move not in '1 2 3'.split():
- print('Сколько палочек вы хотите взять? (не больше 3)')
- move = input()
- return int(move)
- def drawBoard(theTurn, theSticks):
- print('Осталось палочек: %s' %(theSticks))
- print('Ходит %s' %(theTurn))
- sticks = 10
- turn = whoIsFirst()
- print('Первым ходит %s' %(turn))
- while sticks > 0:
- if turn == 'Игрок 1':
- drawBoard(turn, sticks)
- move = makeMove()
- sticks -= move
- if sticks <= 0:
- print('Победил %s!' %(turn))
- break
- turn = 'Игрок 2'
- else:
- turn = 'Игрок 2'
- if turn == 'Игрок 2':
- drawBoard(turn, sticks)
- move = makeMove()
- sticks -= move
- if sticks <= 0:
- print('Победил %s!' %(turn))
- break
- turn = 'Игрок 1'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement