\DELAY OF REWARD
\First rat version (January 29, 2004)
\Filip van den Bergh
\In a five-block experiment, animals choose between a small, immediate
\reinforcer and a large, delayed reinforcer. Each block consists of
\five trials. The first two trials are fixed, only one choice possible,
\while the remaining trials are choice.
\The code was adjusted into a condensed version consisting of 5x5
\blocksxtrials, with a trial lasting only 15s more than the longest delay.
\Z-pulses
\1 Start session
\2 End session
\3 Start new block
\4 Start trial
\5 Small choice
\6 Large choice
\7 Omission
\COMMON CODE SECOND ARRAY
^Left=1
^ExtLeft=1
^LeftExt=1
^Leftresp=1
^LeftLever=1
^Right=2
^ExtRight=2
^RightExt=2
^RightResp=2
^RightLever=2
^Tone=3
^Feeder=4
^Magazine=4
^LeftLight=5
^Middlelight=6
^Centrelight=6
^MagazineLight=6
^RightLight=7
^Houselight=8
\End common code
\Inputs
^LeftLever=4
^RightLever=2
^Magazine=3
\Training parameters
LIST M=10,100,6, 5, 10, 90, 15
\LIST D=60, 60, 30, 20, 10, 5, 0, 0
LIST D=0, 0, 5, 10, 30, 60, 60
\Delay for every of the 5 blocks, D(0) en D(6) doen niet mee
var_alias Reward size = Q
var_alias Maximum choice time = M(0)
var_alias Trial length = M(1)
var_alias Inter-block trials (<10!) = M(2)
var_alias Number of blocks = M(3)
var_alias Maximum time to invoke trials = M(4)
var_alias Maximum session time hopefully only reached during the very first training trials = M(5)
var_alias Time left for eating in the condensed version of the task = M(6)
\System variables
var_alias Block = B
var_alias Trial = T
var_alias Small reward lever = Z
var_alias Large reward lever = X
LIST E=0,1
var_alias Choices = E
DIM F=1 \Chosen lever, once for the first forced trial, once for the second
DIM G=1 \Forced lever options
DIM H=1 \Forced lever options extend lever
\Dependents
DIM R=80 \Response -1=small, 1=large, 9=omission 0=trial not initiated
var_alias Choice for small reward = I
var_alias Choice for large reward = O
DIM L=80 \Response latency, Large
DIM N=80 \Response latency, Small
DIM C=80 \Collection latency
DIM S=4
var_alias Total time = S(0)
var_alias Rewards counter = S(1) \counts up to Q
var_alias Latency counter = S(2)
var_alias Latency counter for collection = S(3)
var_alias Latency memory for substraction from M(1) = S(4)
\=== Session start, end and time counter =============================
S.S.1,
S1,
0.1": SET G(0)=^LeftLever;
SET G(1)=^RightLever;
SET H(0)=^LeftExt;
SET H(1)=^RightExt ---> S2
S2,
0.1": SET Z=^LeftLever; \small
SET X=^RightLever; \large
SET Q=4 ---> S5 \rewards
S5,
#START: SET M(0)=M(0)*1";
SET M(1)=M(1)*1";
SET M(4)=M(4)*1";
SET M(6)=M(6)*1";
SET D(0)=D(0)*1";
SET D(1)=D(1)*1";
SET D(2)=D(2)*1";
SET D(3)=D(3)*1";
SET D(4)=D(4)*1";
SET D(5)=D(5)*1";
SET D(6)=D(6)*1";
ON ^Houselight; Z1 ---> S10
S10,
#Z2: SHOW 1, Closed, S(0)/60;
OFF ^RightExt,^LeftExt,^HouseLight ---> StopAbortFlush
0.1": SET S(0)=S(0)+.1; IF S(0)/60>M(5) [@TrueStop, @FalseContinue]
@TrueStop: SHOW 1, Closed, S(0)/60;
OFF ^RightExt,^LeftExt,^HouseLight ---> StopAbortFlush
@FalseContinue: ---> S10
\=== Trial ===========================================================
S.S.5,
S1,
#Z1: ---> S4
S4,
(M(1)-S(4))#T: ON^CentreLight ---> S5
S5, \Trial core: forced trials
#R^Magazine: OFF^CentreLight;ADD B; IF B>M(3) [@TrueEnd, @FalseContiue]
@TrueEnd: Z2; SHOW 1, Closed, S(0)/60;
OFF ^RightExt,^LeftExt,^HouseLight ---> StopAbortFlush
@FalseContinue: SET T=1; SET M(1)= D(B)+M(6); \\INCLUDED THIS LINE TO MAKE THE SESSION SHORTER!! NOW THE TRIAL LENGTH IS DIFFERENT FOR EACH BLOCK
RANDI F(0)=E; \WAS RANDD
SET F(1)=(F(0)-1)*-1;
ON H(F(0));
Z4 ---> S6
S6, \First forced trial
#RG(F(0)): IF G(F(0))=Z [@TrueSmall, @FalseLarge]
@TrueSmall: Z5; SET R(B*10+T)=-1; OFF H(F(0)); ADD T ---> S8
@FalseLarge: Z6; SET R(B*10+T)=1; OFF H(F(0)); ADD T ---> S8
\M(0)#T: Z7; SET R(B*10+T)=9; OFF H(F(0)); ADD T ---> S8
S7, \Wait for collection
#R^Magazine: ---> S8
S8,
(M(1)-S(4))#T: ON^CentreLight ---> S9
S9, \Second forced trial
#R^Magazine: OFF^CentreLight; ON H(F(1)); Z4 ---> S10
S10,
#RG(F(1)): IF G(F(1))=Z [@TrueSmall, @FalseLarge]
@TrueSmall: Z5; SET R(B*10+T)=-1; OFF H(F(1)); ADD T ---> S14
@FalseLarge: Z6; SET R(B*10+T)=1; OFF H(F(1)); ADD T ---> S14
\M(0)#T: Z7; SET R(B*10+T)=9; OFF H(F(1)); ADD T ---> S14
S11, \Wait for collection
#R^Magazine: ---> S14
S14,
(M(1)-S(4))#T: ON^CentreLight ---> S15
S15, \Choice trials
#R^Magazine: OFF^CentreLight;ON ^LeftExt,^RightExt; Z4 ---> S16
S16,
#RZ: Z5; SET R(B*10+T)=-1; OFF ^LeftExt, ^RightExt; ADD T; ADD I; IF T>M(2) [@TrueNewblock, @FalseContinue]
@TrueNewblock: ---> S4
@FalseContinue: ---> S14
#RX: Z6; SET R(B*10+T)=1; OFF ^LeftExt, ^RightExt; ADD T; ADD O; IF T>M(2) [@TrueNewblock, @FalseContinue]
@TrueNewblock: ---> S4
@FalseContinue: ---> S14
M(0)#T: Z7; SET R(B*10+T)=9; OFF ^LeftExt, ^RightExt; ADD T; IF T>M(2) [@TrueNewblock, @FalseContinue]
@TrueNewblock: ---> S4
@FalseContinue: ---> S14
\=== Rewards==========================================================
S.S.6,
S1,
#Z5: ON ^Feeder, ^LeftLight ---> S10 \\THE LIGHT CODE IS NOT FLEXIBLE/PORTABLE
#Z6: ON ^RightLight ---> S2 \\AND AGAIN
S2,
D(B)#T: SET S(1)=0; ON ^Feeder; ADD S(1) ---> S3
S3,
0.1": OFF ^Feeder ---> S4
S4,
0.1": ON ^Feeder; ADD S(1); IF S(1) S3
@FalseEnough: ---> S10
S10,
1": OFF ^Feeder; OFF ^LeftLight, ^RightLight ---> S1
\=== Latencies =======================================================
S.S.7,
S1,
#Z4: SET S(2)=0 ---> S2
S2,
0.1": SET S(2)=S(2)+0.1 ---> S2
#Z5: SET N(B*10+T)=S(2); SET S(4)=S(2) ---> S3
#Z6: SET L(B*10+T)=S(2); SET S(4)=S(2) ---> S3
S3,
0.1": SET S(3)=S(3)+0.1; IF S(3)>M(0) [@TrueStop,@FalseCOntinue]
@TrueStop: SET C(B*10+T)=-1 ---> S1
@FalseContinue: ---> S3
#R^Magazine: SET C(B*10+T)=S(3); SET S(3)=0 ---> S1
\=== Screen code =====================================================
S.S.10,
S1,
.1": SHOW 1,Minutes,S(0)/60;
SHOW 4,Delay,D(B);
SHOW 3,PrefSm,I/(I+O+.00000001)*100;
SHOW 5,Trial,B*10+T;
SHOW 6, Delay 2, D(2);
SHOW 7, Delay 3, D(3);
SHOW 8, Delay 4, D(4);
SHOW 9, Delay 5, D(5);
SHOW 10, Delay 6, D(6);
SHOW 11, Chc lat, S(4);
SHOW 17, Chc 1-3, R(13);
SHOW 18, Chc 1-4, R(14);
SHOW 19, Chc 1-5, R(15);
SHOW 20, Chc 1-6, R(16);
SHOW 22, Chc 2-3, R(23);
SHOW 23, Chc 2-4, R(24);
SHOW 24, Chc 2-5, R(25);
SHOW 25, Chc 2-6, R(26);
SHOW 27, Chc 3-3, R(33);
SHOW 28, Chc 3-4, R(34);
SHOW 29, Chc 3-5, R(35);
SHOW 30, Chc 3-6, R(36);
SHOW 32, Chc 4-3, R(43);
SHOW 33, Chc 4-4, R(44);
SHOW 34, Chc 4-5, R(45);
SHOW 35, Chc 4-6, R(46);
SHOW 37, Chc 5-3, R(53);
SHOW 38, Chc 5-4, R(54);
SHOW 39, Chc 5-5, R(55);
SHOW 40, Chc 5-6, R(56) ---> S1
#Z4: SHOW 2,Start,B*10+T ---> S1
#Z5: SHOW 2,Ch_Sm,0 ---> S1
#Z6: SHOW 2,Ch_La,0 ---> S1
#Z7: SHOW 2,Omission,0 ---> S1
|