def find_moves(self): dir = self.direction x = self._x y = self._y possible_moves = [] mov = [x + 1, y + (1 * dir)] if check_move_(self.board, mov, self._color_is) == 2: possible_moves.append(mov) mov = [x - 1, y + (1 * dir)] if check_move_(self.board, mov, self._color_is) == 2: possible_moves.append(mov) mov = [x, y+(1*dir)] if check_move_(self.board, mov, self._color_is) == 1: possible_moves.append(mov) if self.done_moves == 0: mov = [x, y + (2 * dir)] if check_move_(self.board, mov, self._color_is) == 1: possible_moves.append(mov) return possible_moves
def find_moves(self): x = self._x y = self._y possible_moves = [] for i in range(-1, 2, 1): for u in range(-1, 2, 1): mov = [x + i, y + u] if check_move_(self.board, mov, self._color_is) == 1: possible_moves.append(mov) elif check_move_(self.board, mov, self._color_is) == 2: possible_moves.append(mov) return possible_moves
def find_moves(self): x = self._x y = self._y possible_moves = [] to_check = [[x + 2, y + 1], [x + 2, y - 1], [x - 2, y + 1], [x - 2, y - 1], [x + 1, y + 2], [x - 1, y + 2], [x + 1, y - 2], [x - 1, y - 2]] for mov in to_check: if check_move_(self.board, mov, self._color_is) == 1: possible_moves.append(mov) elif check_move_(self.board, mov, self._color_is) == 2: possible_moves.append(mov) return possible_moves
def find_moves(self): x = self._x y = self._y possible_moves = [] # movement in right down dir for i in range(x + 1, 8): mov = [i, y + (i - x)] if check_move_( self.board, mov, self._color_is ) == 1: # this solution works great if there is some obstacle in the way possible_moves.append(mov) elif check_move_(self.board, mov, self._color_is) == 2: possible_moves.append(mov) break else: break # movement in left down dir for i in range(x - 1, -1, -1): mov = [i, y + (x - i)] if check_move_( self.board, mov, self._color_is ) == 1: # this solution works great if there is some obstacle in the way possible_moves.append(mov) elif check_move_(self.board, mov, self._color_is) == 2: possible_moves.append(mov) break else: break # movement in right top dir for i in range(x + 1, 8): mov = [i, y - (i - x)] if check_move_( self.board, mov, self._color_is ) == 1: # this solution works great if there is some obstacle in the way possible_moves.append(mov) elif check_move_(self.board, mov, self._color_is) == 2: possible_moves.append(mov) break else: break # movement in left up dir for i in range(x - 1, -1, -1): mov = [i, y - (x - i)] if check_move_( self.board, mov, self._color_is ) == 1: # this solution works great if there is some obstacle in the way possible_moves.append(mov) elif check_move_(self.board, mov, self._color_is) == 2: possible_moves.append(mov) break else: break return possible_moves