@@ -10,7 +10,6 @@ def create_board():
1010
1111board = create_board ()
1212
13-
1413def place (board , player , position ):
1514 if board [position ] == 0 :
1615 board [position ] = player
@@ -28,9 +27,6 @@ def possibilities(board):
2827 # ... and so on. Then using map function convert each of them to tuple.
2928 # And keep it totally as a list.
3029 return z
31- # selection=possibilities(board)
32- # print (y)
33-
3430
3531def random_place (board , player ):
3632 position = random .choice (possibilities (board ))
@@ -39,10 +35,6 @@ def random_place(board, player):
3935
4036board = random_place (board , 2 )
4137
42- # row_win
43- # write your code here!
44-
45-
4638def row_win (board , player ):
4739 for i in range (3 ):
4840 if (player == board [i ][0 ]):
@@ -55,7 +47,6 @@ def row_win(board, player):
5547
5648row_win (board , 1 )
5749
58-
5950def col_win (board , player ):
6051 for i in range (3 ):
6152 if (player == board [0 ][i ]):
@@ -68,9 +59,6 @@ def col_win(board, player):
6859
6960col_win (board , 1 )
7061
71- # diag_win
72-
73-
7462def diag_win (board , player ):
7563 z = 0
7664 for i in range (3 ):
@@ -84,8 +72,6 @@ def diag_win(board, player):
8472diag_win (board , 1 )
8573
8674# Evaluate
87-
88-
8975def evaluate (board ):
9076 winner = 0
9177 for player in [1 , 2 ]:
@@ -103,8 +89,6 @@ def evaluate(board):
10389evaluate (board )
10490
10591# play_game()
106-
107-
10892def play_game ():
10993 board = create_board ()
11094 if (0 in board ):
@@ -113,8 +97,8 @@ def play_game():
11397 z = evaluate (board )
11498 player = 2
11599 return z
116- # plot
117100
101+ # plot
118102R = 1000
119103ty = []
120104r = []
@@ -131,7 +115,6 @@ def play_game():
131115plt .hist (x )
132116plt .show ()
133117
134-
135118# play strategic
136119def play_strategic_game ():
137120 board , winner = create_board (), 0
0 commit comments