@@ -8,8 +8,10 @@ def create_board():
88 x = np .zeros ((3 , 3 ))
99 return x
1010
11+
1112board = create_board ()
1213
14+
1315def place (board , player , position ):
1416 if board [position ] == 0 :
1517 board [position ] = player
@@ -33,8 +35,10 @@ def random_place(board, player):
3335 # print (position)
3436 return place (board , player , position )
3537
38+
3639board = random_place (board , 2 )
3740
41+
3842def row_win (board , player ):
3943 for i in range (3 ):
4044 if (player == board [i ][0 ]):
@@ -45,8 +49,10 @@ def row_win(board, player):
4549 else :
4650 print ("False" )
4751
52+
4853row_win (board , 1 )
4954
55+
5056def col_win (board , player ):
5157 for i in range (3 ):
5258 if (player == board [0 ][i ]):
@@ -57,8 +63,10 @@ def col_win(board, player):
5763 else :
5864 print ("False" )
5965
66+
6067col_win (board , 1 )
6168
69+
6270def diag_win (board , player ):
6371 z = 0
6472 for i in range (3 ):
@@ -69,8 +77,10 @@ def diag_win(board, player):
6977 else :
7078 print ("False" )
7179
80+
7281diag_win (board , 1 )
7382
83+
7484# Evaluate
7585def evaluate (board ):
7686 winner = 0
@@ -85,9 +95,10 @@ def evaluate(board):
8595 winner = - 1
8696 return winner
8797
88- # add your code here.
98+
8999evaluate (board )
90100
101+
91102# play_game()
92103def play_game ():
93104 board = create_board ()
@@ -129,8 +140,10 @@ def play_strategic_game():
129140 break
130141 return winner
131142
143+
132144play_strategic_game ()
133145
146+
134147# plotting play-strategic-game
135148# write your code here!
136149R = 1000
0 commit comments