minor modifications of linearTD to deal with q-values properly