def get_action(self, board: Board): state, available = board.current_dqn_config() # print('state') # print(state.shape) # print(state) # print('available') # print(available.shape) # print(available) # print(state.reshape(1, 2 * self.width**2)) qval = self.agent.predict(state.reshape(1, 2 * self.width**2)) # print('qval') # print(qval.shape) # print(qval) action = np.argmax(qval + available.reshape(1, self.width**2)) return action