Answer the question
In order to leave comments, you need to log in
[[+content_image]]
How to prevent a move further when a piece is found on the board?
I'm trying to make it so that when a piece is detected, the next move is impossible, since it will already be a jump.
Board
board = [['bluerook', ' ', ' ', ' ', 'bluepawn', ' ', ' ', ' '],
['bluepawn', ' ', ' ' ', ' ', ' ', ' ', ' ', ' '],
[' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ']]]
class bluerook(self.x, self.y, moveX, moveY, cell):
""" self.x, self.y - where piece now
moveX, moveY, - where piece can be dragged
cell - where piece can be dragged
"""
rule = None
piece_on_my_way = False
if self.x == moveX:
while rule is None:
if cell != ' ' and not piece_on_my_way:
piece_on_my_way = True
elif cell == ' ' and not piece_on_my_way:
rule = True
while piece_on_my_way:
if cell = ' ':
rule = False
elif cell != ' ':
rule = False
return rule
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question