Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def winner_check(line1, line2, line3, player):
- if (line1[0] == player and line1[1] == player and line1[2] == player) or \
- (line2[0] == player and line2[1] == player and line2[2] == player) or \
- (line3[0] == player and line3[1] == player and line3[2] == player) or \
- (line1[0] == player and line2[1] == player and line3[2] == player) or \
- (line1[2] == player and line2[1] == player and line3[0] == player) or \
- (line1[0] == player and line2[0] == player and line3[0] == player) or \
- (line1[1] == player and line2[1] == player and line3[1] == player) or \
- (line1[2] == player and line2[2] == player and line3[2] == player):
- return True
- return False
- player1 = 1
- player2 = 2
- track_line1 = list(map(int, input().split()))
- track_line2 = list(map(int, input().split()))
- track_line3 = list(map(int, input().split()))
- if winner_check(track_line1, track_line2, track_line3, player1):
- print('First player won')
- elif winner_check(track_line3, track_line2, track_line1, player2):
- print('Second player won')
- else:
- print('Draw!')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement