def _beta_operator(self, board: Board): """ ß-operator of the ß-climbing, introduces exploration to the algorithm :param board: Neighbouring state of the board :return: New state of the board """ values = board.values() # scan the board for pos in board.unfilled_positions(): # regenerate the value if it meets the probability of beta if self._with_probability(self._beta_prob): values[pos.y, pos.x] = self._generate_fill_number() # fill the board board.fill_board(values) return board
def _neighbouring_operator(self, board: Board): """ N-operator of the ß-climbing, introduces exploitation to the algorithm :param board: State of the board :return: Neighbouring state """ values = board.values() # iterate modifiable tiles for pos in board.unfilled_positions(): # modify the tile if it meets the probability of n if self._with_probability(self._n_prob): values[pos.y, pos.x] = self._neighbouring_val(values[pos.y, pos.x]) # fill the board board.fill_board(values) return board