battle shape with communication
No preview image
Model was written in NetLogo 6.3.0
•
Viewed 53 times
•
Downloaded 5 times
•
Run 0 times
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
Comments and Questions
Please start the discussion about this model!
(You'll first need to log in.)
Click to Run Model
globals [ allies enemies ] patches-own [ pheromone ;; amount of pheromone on this patch center ;; amount of food on this patch (0, 1, or 2) relaystation ] turtles-own [ team health ] to setup clear-all set-default-shape turtles "person" setup-center setup-relaystation reset-ticks end to setup-center ask patch (0.8 * min-pxcor) (0.8 * max-pycor) [ set plabel "Alies center" make-center-source blue ] ask patch(0.8 * max-pxcor) (0.8 * min-pycor) [ set plabel "Enemies center" make-center-source red ] end to make-center-source [ center-source-color ] ;; patch procedure ask patches with [ distance myself < 5 ] [ set center 2 set pcolor center-source-color ] end to setup-relaystation ask patch (0.7 * min-pxcor) (0.3 * max-pycor) [ set plabel "relaystation1" make-relaystation-source sky ] ask patch (0.7 * max-pxcor) (0.7 * max-pycor) [ set plabel "relaystation3" make-relaystation-source green ] ask patch(0.7 * max-pxcor) (0.3 * min-pycor) [ set plabel "relaystation2" make-relaystation-source orange ] ask patch (0.7 * min-pxcor) (0.7 * min-pycor) [ set plabel "relaystation4" make-relaystation-source green ] end to make-relaystation-source [ relaystation-source-color ] ;; patch procedure ask patches with [ distance myself < 5 ] [ set relaystation 2 set pcolor relaystation-source-color ] end to create-person create-turtles 1 [ set team "allies" setxy -35 35 set health 10 set color blue set size 4 ] create-turtles 1 [ set team "enemies" setxy 35 -35 set health 10 set color red set size 4 ] end to go if count turtles < population [ create-person ] ask turtles [ if health <= 0 [die] move attack move-towards-relaystation ] tick end to move wander end to wander ;; turtle procedure rt random 40 lt random 40 if not can-move? 1 [ rt 180 ] fd 1 end to move-towards-relaystation let relaystation-patch nobody let gather-threshold 10 if team = "allies" [ set relaystation-patch min-one-of patches with [plabel = "relaystation1" or plabel = "relaystation2" or plabel = "relaystation3" or plabel = "relaystation4"] [distance myself] ] if team = "enemies" [ set relaystation-patch min-one-of patches with [plabel = "relaystation1" or plabel = "relaystation2" or plabel = "relaystation3" or plabel = "relaystation4"] [distance myself] ] if relaystation-patch != nobody [ if count turtles-on relaystation-patch < gather-threshold [ face relaystation-patch fd 1 ] ; 추가된 부분 if count turtles-on relaystation-patch = gather-threshold [ ; gather-threshold에 도달했을 때 움직임을 멈추도록 설정 stop ] ] end to attack let target one-of other turtles-here with [team != [team] of myself] if target != nobody [ ask target [ set health health - 10 ] ] end to attack-center [center-label x y] let target-center patch x y if target-center != nobody and [plabel] of target-center = center-label [ ask target-center [ set center 0 ; center를 0으로 변경하여 공격한 것을 표시 ] ] end
There is only one version of this model, created over 1 year ago by HYOSEONG SEO.
Attached files
No files
This model does not have any ancestors.
This model does not have any descendants.