battle shape with communication
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
WHAT IS IT?
(a general understanding of what the model is trying to show or explain)
HOW IT WORKS
(what rules the agents use to create the overall behavior of the model)
HOW TO USE IT
(how to use the model, including a description of each of the items in the Interface tab)
THINGS TO NOTICE
(suggested things for the user to notice while running the model)
THINGS TO TRY
(suggested things for the user to try to do (move sliders, switches, etc.) with the model)
EXTENDING THE MODEL
(suggested things to add or change in the Code tab to make the model more complicated, detailed, accurate, etc.)
NETLOGO FEATURES
(interesting or unusual features of NetLogo that the model uses, particularly in the Code tab; or where workarounds were needed for missing features)
RELATED MODELS
(models in the NetLogo Models Library and elsewhere which are of related interest)
CREDITS AND REFERENCES
(a reference to the model's URL on the web if it has one, as well as any other necessary credits, citations, and links)
Comments and Questions
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 2 years ago by HYOSEONG SEO.
Attached files
No files
This model does not have any ancestors.
This model does not have any descendants.
HYOSEONG SEO
I want to add a communication function to the battle model. Please help.
1. Allied and enemy bases exist as centers 2. Relay stations are displayed as patches (want to be displayed at random locations) 3. When each object of the allies and enemies is randomly located in the relay station and the number of relay stations reaches 10 Allies attack the enemy's center, and the enemy attacks the friendly center. 4. If the cneter is destroyed first, you lose. In the end, I want to show that the closer the relay station is, the faster it gathers, and the quicker it is to attack the center to achieve the goal. I'm a newbe so I'm not good at it. Is there an expert who can fix the code? help
Posted over 2 years ago
HYOSEONG SEO
I want to add a communication function to the battle model. Please help.
1. Allied and enemy bases exist as centers 2. Relay stations are displayed as patches (want to be displayed at random locations) 3. When each object of the allies and enemies is randomly located in the relay station and the number of relay stations reaches 10 Allies attack the enemy's center, and the enemy attacks the friendly center. 4. If the cneter is destroyed first, you lose. In the end, I want to show that the closer the relay station is, the faster it gathers, and the quicker it is to attack the center to achieve the goal. I'm a newbe so I'm not good at it. Is there an expert who can fix the code? help
Posted over 2 years ago