File tree Expand file tree Collapse file tree 1 file changed +6
-10
lines changed
Code-Sleep-Python/tic-tac-toe Expand file tree Collapse file tree 1 file changed +6
-10
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,6 @@ def create_board():
88 x = np .zeros ((3 , 3 ))
99 return x
1010
11-
1211board = create_board ()
1312
1413
@@ -30,12 +29,12 @@ def possibilities(board):
3029 # And keep it totally as a list.
3130 return z
3231
32+
3333def random_place (board , player ):
3434 position = random .choice (possibilities (board ))
3535 # print (position)
3636 return place (board , player , position )
3737
38-
3938board = random_place (board , 2 )
4039
4140
@@ -48,8 +47,7 @@ def row_win(board, player):
4847 print ("False" )
4948 else :
5049 print ("False" )
51-
52-
50+
5351row_win (board , 1 )
5452
5553
@@ -62,8 +60,7 @@ def col_win(board, player):
6260 print ("False" )
6361 else :
6462 print ("False" )
65-
66-
63+
6764col_win (board , 1 )
6865
6966
@@ -76,8 +73,7 @@ def diag_win(board, player):
7673 print ("True" )
7774 else :
7875 print ("False" )
79-
80-
76+
8177diag_win (board , 1 )
8278
8379
@@ -95,12 +91,12 @@ def evaluate(board):
9591 winner = - 1
9692 return winner
9793
98-
9994evaluate (board )
10095
10196
10297# play_game()
10398def play_game ():
99+
104100 board = create_board ()
105101 if (0 in board ):
106102 player = 1
@@ -109,6 +105,7 @@ def play_game():
109105 player = 2
110106 return z
111107
108+
112109# plot
113110R = 1000
114111ty = []
@@ -140,7 +137,6 @@ def play_strategic_game():
140137 break
141138 return winner
142139
143-
144140play_strategic_game ()
145141
146142
You can’t perform that action at this time.
0 commit comments