\ FIXED INTERVAL 40s
\ v0.1
\Insert common code here
^Houselight=7
^Feederlight=8
^Reward=17
\INDEPENDENTS
DIM A=2
VAR_ALIAS Maximum duration=A(0)
VAR_ALIAS Reward interval=A(1)
VAR_ALIAS Time offset=A(2)
\INDEPENDENTS
DIM X=2
VAR_ALIAS Duration=X(0)
VAR_ALIAS Time to next reward=X(1)
VAR_ALIAS Rewards=X(2)
S.S.1,
S1,
.01": SET A(0)=600;
SET A(1)=20;
SET A(2)=0 > S2
S2,
#START: ON^Houselight;
SET A(0)=A(0)+A(2);
SET A(1)=A(1)*1";
SET A(2)=A(2)*1" > S3
S3,
A(2)#T: > S4
S4,
A(1)#T: Z^Reward;
IF X(0)>A(0) [@EndSession;@Continue]
@EndSession: > STOPABORTFLUSH
@Continue: > S4
S.S.2,
S1,
#Z^Reward: ON^Reward,^Feederlight; ADD X(2) > S2
S2,
1": OFF^Reward,^Feederlight > S1
S.S.3,
S1,
#START: > S2
S2,
.1": SET X(0)=X(0)+.1;
SHOW 1,duration,X(0);
SHOW 2,rewards,X(2) > S2
