Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
final pepify
  • Loading branch information
prateekiiest authored May 11, 2018
commit eb18f7695a6482f08d52cab0c4bdcad279724023
16 changes: 6 additions & 10 deletions Code-Sleep-Python/tic-tac-toe/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ def create_board():
x = np.zeros((3, 3))
return x


board = create_board()


Expand All @@ -30,12 +29,12 @@ def possibilities(board):
# And keep it totally as a list.
return z


def random_place(board, player):
position = random.choice(possibilities(board))
# print (position)
return place(board, player, position)


board = random_place(board, 2)


Expand All @@ -48,8 +47,7 @@ def row_win(board, player):
print("False")
else:
print("False")



row_win(board, 1)


Expand All @@ -62,8 +60,7 @@ def col_win(board, player):
print("False")
else:
print("False")



col_win(board, 1)


Expand All @@ -76,8 +73,7 @@ def diag_win(board, player):
print("True")
else:
print("False")



diag_win(board, 1)


Expand All @@ -95,12 +91,12 @@ def evaluate(board):
winner = -1
return winner


evaluate(board)


# play_game()
def play_game():

board = create_board()
if(0 in board):
player = 1
Expand All @@ -109,6 +105,7 @@ def play_game():
player = 2
return z


# plot
R = 1000
ty = []
Expand Down Expand Up @@ -140,7 +137,6 @@ def play_strategic_game():
break
return winner


play_strategic_game()


Expand Down