-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathW_Maze_beta_more_reward_nocomment.sc
More file actions
executable file
·110 lines (80 loc) · 2.73 KB
/
W_Maze_beta_more_reward_nocomment.sc
File metadata and controls
executable file
·110 lines (80 loc) · 2.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
int deliverPeriod = 500 % blinking delay
int lastSideWell= 0 % 1 if left, 3 if right ... this variable tracks the previously activated side well.
int lastWell=0 % 1 if left, 3 if right, 2 if center ... this variable trackes the previously activated well
int currWell= 0 % current well ... this variable keeps track of when a well was made active.
% vars for tracking where and how much reward
int rewardWell= 0 % reward well
int nowRewarding = 0
int count= 0 % blink count
function 1
nowRewarding = 1 % nowRewarding
portout[rewardWell]=1 % reward
do in deliverPeriod % do after waiting deliverPeriod milliseconds
portout[rewardWell]=0 % reset reward
nowRewarding=0 % no longer rewarding
end
end;
function 2
if lastWell==0 do
rewardWell=currWell
trigger(1)
end
end;
callback portin[1] up
disp('Portin1 up - Left well on') % Print state of port to terminal
currWell=1 % Left/1 well active
trigger(2) % Reward if first poke
if lastWell == 2 do % Check if previous well = center
if lastSideWell == 3 do % Check if side last visited = right
disp('Rewarding Well Left')
rewardWell=1 % dispense reward from here
trigger(1) % trigger reward
end
end
end;
callback portin[1] down
if rewardWell != 0 do
portout[rewardWell] = 0 % Reset reward well- if not first trial
end
disp('Portin1 down - Left well off') % Print state of port to terminal
lastWell = 1 % Well left, now last well
lastSideWell = 1
end;
callback portin[2] up
disp('Portin2 up - Center well on') % Print state of port 2
currWell = 2
trigger(2) % Reward if first poke
if lastWell == 1 || lastWell == 3 do % Did the animal previously visit left/right arm?
disp('Rewarding Well Center')
rewardWell = 2
trigger(1)
end
end;
callback portin[2] down
if rewardWell != 0 do
portout[rewardWell] = 0
end
disp('Portin2 down - Center well off'') % Print state of port 2
lastWell=2 % Well center is now the last well
end;
callback portin[3] up
disp('portin3 up') % Print state of port to terminal
trigger(1) % Run Error Check
currWell = 3 % Set currently active well
trigger(2) % Reward if first poke
if lastWell == 2 do % Did animal last visit center arm?
if lastSideWell == 1 do % Was previous side arm left?
disp('Rewarding Well Right')
rewardWell=3 % Dispense reward from here
trigger(1) % Trigger reward
end
end
end;
callback portin[3] down
if rewardWell != 0 do
portout[rewardWell] = 0 % Reset reward well- if not first trial
end
disp('Portin3 down - Right well off')
lastWell=3 % Well left, now last well
lastSideWell = 3
end;