Last active
November 6, 2019 15:11
-
-
Save Tony363/259a1def6bc3ddeffe68e9136f9103b5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import random | |
# matrix = [ | |
# [1,2], | |
# [3,4], | |
# [5,6], | |
# ] | |
# tony = [[row[i] for row in matrix] for i in range(2)] | |
# print(tony) | |
# points = random.sample([range(1,7),range(1,7)],3) | |
# print(points) | |
losing_condition = [ | |
[[x,y] for x in range(1,7) for y in range(1,7) if x!=y], | |
[[y,z] for y in range(1,7) for z in range(1,7)if y!=z], | |
[[z,x] for z in range(1,7) for x in range(1,7)if z!=x], | |
] | |
# print(losing_condition) | |
def choice_character(*args): | |
player_1 = input('Enter your character:') | |
player_2 = input('Enter your character:') | |
if player_1 == player_2: | |
sys.exit(1) | |
return player_1,player_2 | |
def player_move(*args): | |
player_1_move = [] | |
for i in range(2): | |
player = int(input('Enter Coordinates:')) | |
if player > 6 or player < 1: | |
break | |
player_1_move.append(player) | |
if(len(set(player_1_move))==1): | |
sys.exit(1) | |
return player_1_move | |
print(choice_character()) | |
player_1_moves = [player_move() for player_moves in range(15)] | |
# player_2_moves = [player_move() for player_move in range(15)] | |
print('Moves of player 1:',player_1_moves) | |
# print('Moves of player 2:',player_2_moves) | |
for move in player_1_moves: | |
organized_move = move.sort() | |
for side in losing_condition: | |
for vertices in side: | |
organized_vertices = vertices.sort() | |
if organized_move == organized_vertices: | |
print(organized_move, organized_vertices) | |
print(player_move()) | |
def choice_character(*args): | |
player_1 = input() | |
player_2 = input() | |
if player_1 == player_2: | |
sys.exit(1) | |
return player_1,player_2 | |
choice_character() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment