original_docstring: 
          Update the Q-table for a given transition
  
          Parameters
          ----------
          q_func : np.ndarray 
              current Q-function
          curr_state: 
              two indices describing the current state
          act_idx: 
              index of the current action
          object_index (int): 
              index of the current object
          reward (float): 
              the immediate reward the agent receives from playing current command
          next_state_1, next_state_2 (int, int): 
              two indices describing the next state
          terminal (bool): 
              True if this episode is over
  
          Returns:
          updated_q_table : An updated version of the q_table
          
docstring: Update the Q-table for a given transition
  Parameters
  
  
docstring_tokens: Update the Q - table for a given transition Parameters
code: def q_table_update(
          self,
          q_func:np.ndarray,
          curr_state_idx:tuple,
          act_idx:int,
          reward:float,
          next_state_idx:tuple,
          terminal:bool
      ):
          """
          Update the Q-table for a given transition
  
          Parameters
          ----------
          q_func : np.ndarray 
              current Q-function
          curr_state: 
              two indices describing the current state
          act_idx: 
              index of the current action
          object_index (int): 
              index of the current object
          reward (float): 
              the immediate reward the agent receives from playing current command
          next_state_1, next_state_2 (int, int): 
              two indices describing the next state
          terminal (bool): 
              True if this episode is over
  
          Returns:
          updated_q_table : An updated version of the q_table
          """
          state_and_action = curr_state_idx + (action_index,)
      
          max_q_next_state = np.max(q_func[next_state_idx])
          q_current_state = q_func[state_and_action]
  
          if not terminal:
              new_q = ( 1.0 - ALPHA ) * q_current_state + ALPHA * ( reward + GAMMA * max_q_next_state)
          
          else:
              new_q = ( 1.0 - ALPHA ) * q_current_state + ALPHA * reward
  
          new_q_func = np.copy(q_func)
          new_q_func[state_and_action] = new_q
  
          return new_q_func
code_tokens: def q_table_update ( self , q_func : np . ndarray , curr_state_idx : tuple , act_idx : int , reward : float , next_state_idx : tuple , terminal : bool ) : state_and_action = curr_state_idx + ( action_index , ) max_q_next_state = np . max ( q_func [ next_state_idx ] ) q_current_state = q_func [ state_and_action ] if not terminal : new_q = ( 1.0 - ALPHA ) * q_current_state + ALPHA * ( reward + GAMMA * max_q_next_state ) else : new_q = ( 1.0 - ALPHA ) * q_current_state + ALPHA * reward new_q_func = np . copy ( q_func ) new_q_func [ state_and_action ] = new_q return new_q_func
short_docstring: Update the Q-table for a given transition
  Parameters
short_docstring_tokens: Update the Q - table for a given transition Parameters
comment: """
          Update the Q-table for a given transition
  
          Parameters
          ----------
          q_func : np.ndarray 
              current Q-function
          curr_state: 
              two indices describing the current state
          act_idx: 
              index of the current action
          object_index (int): 
              index of the current object
          reward (float): 
              the immediate reward the agent receives from playing current command
          next_state_1, next_state_2 (int, int): 
              two indices describing the next state
          terminal (bool): 
              True if this episode is over
  
          Returns:
          updated_q_table : An updated version of the q_table
          """