---pyramidal.nlogo

来自「NETLOGO」· NLOGO 代码 · 共 604 行 · 第 1/2 页

NLOGO
604
字号
breeds [ nmda                                    ; these are the agents in the modelcal                                              ; cal are calcium ions, turtles are magnesium ionsglu1glu2                                              ; glu are the glutamate moleculesampa                                           camk]globals [frequency stopper response perm ]to setupcacrt 6 ask turtles [neuron]                             ; drawing the pyramidal cellchannels                                         ; setting up the nmda receptor-channelsaxonsglut1glut2calcium                                          ; these are the calcum ionscamset perm 0set frequency 0endto move1ifelse pcolor-of patch-here = blue [stop][ifelse distance patch 16 25 < distance patch 13 40 [set heading towards-nowrap patch 16 25 fd 1][set heading towards-nowrap patch 13 40 fd 1]]endto move2ifelse pcolor-of patch-here = blue [stop][ifelse distance patch -16 25 < distance patch -13 40 [set heading towards-nowrap patch -16 25 fd 1][set heading towards-nowrap patch -13 40 fd 1]]endto move3ifelse pcolor-of patch-here != blue  [set heading towards-nowrap patch -13 40 fd 1]    [ifelse any turtles-here with [color = white]        [set heading random -160 jump random 10]         [set heading random 160 jump 10  bind stop]    ] endto bindask camk [move4]dieendto move4if pcolor-of patch-here != blue[ifelse distance patch -16 25 < distance patch 13 40 [set heading towards-nowrap patch -16 25 jump random (distance patch -16 25) if pcolor-of patch-here = blue [per die]][set heading towards-nowrap patch 13 40 jump random (distance patch 13 40)if pcolor-of patch-here = blue [per die]]]endto perif perm < (strength - 1) [set perm (perm + .1)  if perm >= strength [set perm (strength - 1)]]endto freqif frequency < strength [set frequency (frequency + count turtles-here with [color = blue]) ask turtles-here with [color = blue] [die] plot response]endto actionif frequency >= (strength - perm) [ ask turtles with [who < 3 and who > 0] [ jump 10] ask cal [move3]                ask turtle 5                  [ht set shape "box" set size 5                setxy 0 0                set heading 180 st                repeat 200 [set color random 5000 fd .25                                ] ht                     ]                    repeat 5 [plot (-2 * perm)] plot response reuptake]endto reuptakereset-timer set frequency 0set stopper 0glut1glut2 camask turtles with [who < 3 and who > 0] [rt 180 repeat 10 [fd 1 rt 40 lt 40] rt 180]calciumendto axonsask turtle 4 [ hide-turtle]ask turtle 5 [hide-turtle]ask turtle 4 [setxy 25 35 paintset heading 0 jump 5 paint set heading 180 jump 10 paint repeat 3 [set heading 45 jump 10 paint set heading 180 jump 3 paint]setxy -16 24]ask turtle 5[setxy -25 35 paintset heading 0 jump 5 paint set heading 180 jump 10 paintrepeat 3[ set heading (360 - 45) jump 10 paint set heading 180 jump 3 paint]setxy 16 24 ]endto paintask patch-here [ set pcolor red]ask neighbors [set pcolor red ask neighbors [set pcolor red ask neighbors [ set pcolor red]]]endto neuronset color reddraw-neuronendto channelsask turtles with [who < 4] [ht set color white set size 3 set shape "box"]ask turtle 0 [set color cyan setxy -50 -35set heading 45 repeat 70[fd 1 lt .45]ask patch-here [set pcolor blue]ask neighbors [set pcolor green] set heading random -180]ask turtle 1 [setxy -50 -35set heading 45 repeat 85[fd 1 lt .45]ask patch-here [set pcolor blue]ask neighbors [set pcolor green]set heading random -180]ask turtle 2 [setxy 50 -35set heading (360 - 45 )repeat 70[fd 1 rt .45]ask patch-here [set pcolor blue]ask neighbors [set pcolor green]set heading random 180]ask turtle 3[set color cyansetxy 50 -35set heading (360 - 45 )repeat 85[fd 1 rt .45]ask patch-here [set pcolor blue]ask neighbors [set pcolor green]set heading random 180]ask turtles [show-turtle]endto camcreate-camk (strength - (count camk))ask camk [set size 1set color yellowif xcor = 0 and ycor = 0 [ht setxy 0 32jump random 15 st]]endto glut1create-glu1 ((strength / 2)- (count glu1))ask glu1 [set shape "circle"set color blueset size 3hide-turtlesetxy 27 35  set heading random 360   jump random 7 show-turtle] endto glut2create-glu2 ((strength - count glu1) - (count glu2))ask glu2[set shape "circle"set color blueset size 3setxy -27 35set heading random 360jump random 7 show-turtle]endto calciumcreate-cal (20 - count cal)ask cal [set color greenset size 2hide-turtlejump 10ifelse xcor > 0 [ setxy -18 30  set heading random 360   jump random 5 show-turtle] [setxy -18 40set heading random 360jump random 5 show-turtle]]endto draw-neuronhide-turtlesetxy -50 -35set heading 45 repeat 84 [fd 1 lt .45 stamp red]set heading 0repeat 10 [ stamp red fd 1]setxy 50 -35set heading (360 - 45)repeat 84 [fd 1 rt .45 stamp red]set heading 0repeat 10 [stamp red fd 1]setxy -50 -43 set heading 55repeat 22[fd 1 rt .40 stamp red]set heading 90repeat 30 [fd 1 rt 2.5 stamp red]setxy 50 -43 set heading (360 - 55)repeat 22 [fd 1 lt .40 stamp red]set heading 270repeat 30 [fd 1 lt 2.5 stamp red]endto goset stopper 1if perm >= strength [set perm (strength - 1)]ask glu1 [move1]ask glu2 [move2]ask cal  [move3]ask patches with [pcolor = blue] [freq]actionif stopper < 1 [stop]end@#$#@#$#@GRAPHICS-WINDOW60010101344950503.990111001CC-WINDOW650456975543Command CenterBUTTON355010283setupsetupNIL1TOBSERVERBUTTON2715033483GoGoT1TOBSERVERSLIDER10182273115strength

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?