Skip to content

Commit bb36efc

Browse files
authored
Removed blank lines
Removed blank lines for while creating youtube video .
1 parent ab8c506 commit bb36efc

File tree

1 file changed

+0
-39
lines changed

1 file changed

+0
-39
lines changed

tic-tac-toe/code.py

-39
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@ def create_board():
44
x = np.zeros((3,3))
55
return x
66

7-
87
board = create_board()
98

10-
119
def possibilities(board):
1210
y = np.where(board == 0 ) #it gives the indices wherever there are zeros in the form of 2 seperate arrays in a tuple. (array([0, 0, 1, 1, 1, 2, 2, 2]), array([1, 2, 0, 1, 2, 0, 1, 2]))
1311
y= np.array(y) # convert it into array.
@@ -19,17 +17,12 @@ def random_place(board,player):
1917
position = random.choice(possibilities(board))
2018
#print (position)
2119
return place(board, player, position)
22-
2320

2421
board = random_place(board,2)
2522

26-
27-
2823
# row_win
2924
# write your code here!
3025

31-
32-
3326
def row_win(board,player):
3427
for i in range(3):
3528
if(player == board[i][0]):
@@ -42,15 +35,11 @@ def row_win(board,player):
4235

4336
row_win(board,1)
4437

45-
4638
# ccol_win
4739
# write your code here!
4840

49-
5041
# write your code here!
5142

52-
53-
5443
def col_win(board,player):
5544
for i in range(3):
5645
if(player == board[0][i]):
@@ -62,20 +51,12 @@ def col_win(board,player):
6251
print("False")
6352

6453
col_win(board,1)
65-
66-
67-
6854

6955
#diag_win
7056
# write your code here!
71-
7257
# write your code here!
73-
74-
7558
# write your code here!
7659

77-
78-
7960
def diag_win(board,player):
8061
z = 0
8162
for i in range(3):
@@ -86,11 +67,7 @@ def diag_win(board,player):
8667
else:
8768
print("False")
8869

89-
9070
diag_win(board,1)
91-
92-
93-
9471

9572
## Evaluate
9673

@@ -109,8 +86,6 @@ def evaluate(board):
10986
# add your code here.
11087
evaluate(board)
11188

112-
113-
11489
## play_game()
11590

11691
def play_game():
@@ -123,8 +98,6 @@ def play_game():
12398

12499
return z
125100

126-
127-
128101
# plot
129102
import time
130103
import matplotlib.pyplot as plt
@@ -141,8 +114,6 @@ def play_game():
141114
c = e-s
142115
print(c)
143116

144-
145-
146117
x = [r[j] for j in range(R)]
147118
plt.hist(x)
148119
plt.show()
@@ -163,7 +134,6 @@ def play_strategic_game():
163134

164135
play_strategic_game()
165136

166-
167137
# plotting play-strategic-game
168138
# write your code here!
169139
import time
@@ -180,12 +150,3 @@ def play_strategic_game():
180150
x = [z[j] for j in range(R)]
181151
plt.hist(x)
182152
plt.show()
183-
184-
185-
186-
187-
188-
189-
190-
191-

0 commit comments

Comments
 (0)