Skip to content

Commit 2682a14

Browse files
committed
fix: change variable name mix up of players
1 parent cb181af commit 2682a14

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

‎projects/TIC-TAC-TOE-with-AI/tic-tac-toe-AI.py‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -239,11 +239,11 @@ def replay():
239239
print(f"\n{turn} will go first!")
240240

241241
#Asking the user, if ready to play the game; Output will be True or False;
242-
if(mode == 1):
243-
play_game = play()
244-
else:
242+
if(mode == 2):
245243
ent = input("\nThis is going to be fast! Press Enter for the battle to begin!\n")
246244
play_game = 1
245+
else:
246+
play_game = play()
247247

248248
while play_game:
249249

@@ -255,11 +255,11 @@ def replay():
255255
display_board(theBoard, available)
256256

257257
#Position of the input;
258-
if mode == 1:
259-
position = player_choice(theBoard, p2_name, p2_choice)
258+
if mode != 2:
259+
position = player_choice(theBoard, p1_name, p1_choice)
260260
else:
261-
position = CompAI(theBoard, p2_name, p2_choice)
262-
print(f'\n{p2_name} ({p2_choice}) has placed on {position}\n')
261+
position = CompAI(theBoard, p1_name, p1_choice)
262+
print(f'\n{p1_name} ({p1_choice}) has placed on {position}\n')
263263

264264
#Replacing the ' ' at *position* to *p1_choice* in *theBoard* list;
265265
place_marker(theBoard, available, p1_choice, position)

0 commit comments

Comments
 (0)