added capturing circle around possible capture for

legal moves
This commit is contained in:
Karma Riuk 2025-01-31 14:34:54 +01:00
parent a3b7df4e4c
commit d7863e0d81

View File

@ -90,8 +90,21 @@ class GUI(View):
if selected_piece is not None: if selected_piece is not None:
possible_positions = [move.pos for move in legal_moves] possible_positions = [move.pos for move in legal_moves]
if pos in possible_positions: if pos in possible_positions:
radius = .15 * self.tile_size
colour = circle_colours[(x + y) % 2] colour = circle_colours[(x + y) % 2]
move = [move for move in legal_moves if move.pos == pos][0]
if move.is_capturing:
radius = .40 * self.tile_size
self.canvas.create_oval(
(x + .5) * self.tile_size - radius,
(y + .5) * self.tile_size - radius,
(x + .5) * self.tile_size + radius,
(y + .5) * self.tile_size + radius,
fill="",
outline=colour,
width=.075 * self.tile_size,
)
else:
radius = .15 * self.tile_size
self.canvas.create_oval( self.canvas.create_oval(
(x + .5) * self.tile_size - radius, (x + .5) * self.tile_size - radius,
(y + .5) * self.tile_size - radius, (y + .5) * self.tile_size - radius,
@ -101,7 +114,6 @@ class GUI(View):
outline=colour, outline=colour,
) )
piece = board.piece_at(x, 7-y) piece = board.piece_at(x, 7-y)
if piece: if piece: