function reinfComp(alpha,beta)
%reinforcement comparison model from section 2.8 of sutton & barto (1998)

T = 1000;
R = [5 10];

r = zeros(1,T);
p = zeros(2,T);
pi = zeros(1,T);

for t=1:T
    pi(t) = exp(p(1,t))/sum(exp(p(:,t)));
    a = (rand(1)>pi(t))+1; %1 for first action, 2 for second action
    delta = R(a)-r(t);
    p(a,t+1) = p(a,t) + beta*delta; %update for chosen action
    p(3-a,t+1) = p(3-a,t); %no update for other action
    r(t+1) = r(t) + alpha*delta;
end

figure(1),clf
plot(r);
figure(2),clf
plot(p');
figure(3),clf
plot(pi);