@@ -39,7 +39,7 @@ def win_check(board,mark):
39
39
40
40
def random_player ():
41
41
return random .choice ((- 1 , 1 ))
42
-
42
+
43
43
def space_check (board ,position ):
44
44
return board [position ] == ' '
45
45
@@ -49,18 +49,18 @@ def full_board_check(board):
49
49
50
50
def player_choice (board ,player ):
51
51
position = 0
52
-
52
+
53
53
while position not in [1 ,2 ,3 ,4 ,5 ,6 ,7 ,8 ,9 ] or not space_check (board , position ):
54
54
try :
55
55
position = int (input ('Player %s, choose your next position: (1-9) ' % (player )))
56
56
except :
57
57
print ("I'm sorry, please try again." )
58
-
58
+
59
59
return position
60
60
61
61
62
62
def replay ():
63
-
63
+
64
64
return input ('Do you want to play again? Enter Yes or No: ' ).lower ().startswith ('y' )
65
65
66
66
@@ -78,7 +78,7 @@ def replay():
78
78
display_board (available ,theBoard )
79
79
position = player_choice (theBoard ,player )
80
80
place_marker (available ,theBoard ,player ,position )
81
-
81
+
82
82
if win_check (theBoard ,player ):
83
83
display_board (available ,theBoard )
84
84
print (f"Congratulations ! player { player } wins!.." )
@@ -98,4 +98,4 @@ def replay():
98
98
available = [str (num ) for num in range (0 ,10 )]
99
99
100
100
if not replay ():
101
- break
101
+ break
0 commit comments