def learn(self, s, a, r, s_):
    self.check_state_exist(s_)
    self.check_state_exist(s)
    q_predict = self.q_table.ix[(s, a)]
    if (s_ != 'terminal'):
        q_target = (r + (self.gamma * self.q_table.ix[s_, :].max()))
    else:
        q_target = r
    self.q_table.ix[(s, a)] += (self.lr * (q_target - q_predict))
def learn(self, s, a, r, s_):
    self.check_state_exist(s_)
    self.check_state_exist(s)
    q_predict = self.q_table.ix[(s, a)]
    if (s_ != 'terminal'):
        q_target = (r + (self.gamma * self.q_table.ix[s_, :].max()))
    else:
        q_target = r
    self.q_table.ix[(s, a)] += (self.lr * (q_target - q_predict))