agent/DQ_agent.py
def play(self, games: int=100, exploration_rate: float=0.05) -> np.ndarray:
        """
        Run the agent without training for a number of games.

        Args:
            games: the number of games to play
            exploration_rate: the epsilon for epsilon greedy exploration

        Returns:
            an array of scores, one for each game
        """
        # a list to keep track of the scores
        scores = np.zeros(games)
        # iterate over the number of games
        for game in tqdm(range(games), unit='game'):
            done = False
            score = 0
            # reset the game and get the initial state
            state = self._initial_state()

            while not done:
                # predict the best action based on the current state
                action = self.predict_action(state, exploration_rate)
                # hold the action for the number of frames
                next_state, reward, done = self._next_state(action)
                score += reward
                # set the state to the new state
                state = next_state
            # push the score onto the history
            scores[game] = score

        return scores

        Run the agent without training for a number of games.

        Args:
            games: the number of games to play
            exploration_rate: the epsilon for epsilon greedy exploration

        Returns:
            an array of scores, one for each game
        
Run the agent without training for a number of games.
Run the agent without training for a number of games .
def play(self, games: int=100, exploration_rate: float=0.05) -> np.ndarray:
        scores = np.zeros(games)
        for game in tqdm(range(games), unit='game'):
            done = False
            score = 0
            state = self._initial_state()
            while not done:
                action = self.predict_action(state, exploration_rate)
                next_state, reward, done = self._next_state(action)
                score += reward
                state = next_state
            scores[game] = score
        return scores
def play ( self , games : int = 100 , exploration_rate : float = 0.05 ) -> np . ndarray : scores = np . zeros ( games ) for game in tqdm ( range ( games ) , unit = 'game' ) : done = False score = 0 state = self . _initial_state ( ) while not done : action = self . predict_action ( state , exploration_rate ) next_state , reward , done = self . _next_state ( action ) score += reward state = next_state scores [ game ] = score return scores
Run the agent without training for a number of games.
Run the agent without training for a number of games .
"""
        Run the agent without training for a number of games.

        Args:
            games: the number of games to play
            exploration_rate: the epsilon for epsilon greedy exploration

        Returns:
            an array of scores, one for each game
        """ # a list to keep track of the scores # iterate over the number of games # reset the game and get the initial state # predict the best action based on the current state # hold the action for the number of frames # set the state to the new state # push the score onto the history
an array of scores, one for each game
an array of scores one for each game
self
games
int
the number of games to play
the number of games to play
exploration_rate
float
the epsilon for epsilon greedy exploration
the epsilon for epsilon greedy exploration