Skip to content

Commit

Permalink
fix player_black's turn
Browse files Browse the repository at this point in the history
  • Loading branch information
xXUnique31Xx committed Jul 1, 2024
1 parent ced4bb6 commit 23d17dc
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions controller.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import sys
import os
from pathlib import Path
import datetime
from datetime import datetime
import json
from view import GameView
from pieces import *
Expand Down Expand Up @@ -128,12 +128,19 @@ def get_input(self):
columns = ['1', '2', '3', '4', '5', '6', '7', '8']
start_pos = choice[:2]
goal_pos = choice[-2:]
if start_pos[0] in lines and goal_pos[0] in lines and start_pos[1] in columns and goal_pos[1] in columns:
self.player_white.make_move(self.board.correlation[start_pos], self.board.correlation[goal_pos], self.board)
else:
GameView.display_message('Invalid Choice')
self.get_input()

if self.ai == False:
if self.board.currently_playing == 'White':
if start_pos[0] in lines and goal_pos[0] in lines and start_pos[1] in columns and goal_pos[1] in columns:
self.player_white.make_move(self.board.correlation[start_pos], self.board.correlation[goal_pos], self.board)
else:
GameView.display_message('Invalid Choice')
self.get_input()
else:
if start_pos[0] in lines and goal_pos[0] in lines and start_pos[1] in columns and goal_pos[1] in columns:
self.player_black.make_move(self.board.correlation[start_pos], self.board.correlation[goal_pos], self.board)
else:
GameView.display_message('Invalid Choice')
self.get_input()
@staticmethod
def get_symbol_preference():

Expand Down

0 comments on commit 23d17dc

Please sign in to comment.