Lanchester Guerrilla warfare I
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
turtles-own[vision blanco efectividad amigo ip] rojos-own[brigada cubierta] patches-own[cobertura] breed[rojos rojo] ;guerrilla breed[azules azul] to setup clear-all ask patches [set cobertura random-float 5 set pcolor green - cobertura ] create-rojos R[set shape "person" set color red set vision random V set efectividad random-float E set ip random-float 1 set brigada random brigadas set xcor (- brigada + random filas) set ycor random-ycor set cubierta [cobertura] of patch-here set amigo one-of other rojos with [brigada = brigada] ifelse tipoEnfrentamiento = "fila" [set heading 90][set heading random 180]] create-azules A[set shape "person" set color blue set vision random V set efectividad random-float E set ip random-float 1 set xcor 10 + random filas set ycor random-ycor set amigo one-of azules in-radius vision ifelse tipoEnfrentamiento = "fila" [set heading -90][set heading random -180]] reset-ticks end to go if not any? rojos [ user-message "Ganan los azules" stop ] if not any? azules [ user-message "Ganan los rojos" stop ] ask rojos [reune-brigada busca-cobertura] ask turtles[ifelse tipoEnfrentamiento = "perseguir" [rt random 180 fd random-float 2 apunta ifelse blanco != nobody [ifelse ip > 0.5 [apunta get_amigo huir][get_amigo apunta pleitear apunta dispara]][fd random-float 1] ] [fd random-float 2 apunta ifelse blanco != nobody [ifelse ip > 0.5 [apunta get_amigo huir][get_amigo apunta pleitear apunta dispara]][fd random-float 1]] ] tick end to reune-brigada ifelse amigo != nobody [ set heading towards amigo fd random 10][get_amigo] end to busca-cobertura let spot max-one-of patches in-radius vision [cobertura] if spot != nobody[set heading towards spot fd random 10] end to apunta ifelse breed = rojos[let b one-of azules in-radius vision set blanco b][let b one-of rojos in-radius vision set blanco b] ifelse blanco != nobody [set heading (towards blanco)][ifelse breed = rojos[set heading random 180][set heading random -180]] end to dispara-rojo apunta if random-float 1 > efectividad[if blanco != nobody and [cubierta] of blanco < 2.5[ask blanco [die]]] apunta end to dispara-azul apunta if random-float 1 > efectividad[if blanco != nobody [ask blanco [die]]] apunta end to dispara ifelse breed = rojos[dispara-azul][dispara-rojo] end to pleitear ;; move toward the midpoint of your friend and enemy facexy ([xcor] of amigo + [xcor] of blanco) / 2 ([ycor] of amigo + [ycor] of blanco) / 2 fd 0.1 end to huir ;; put your friend between you and your enemy facexy [xcor] of amigo + ([xcor] of amigo - [xcor] of blanco) / 2 [ycor] of amigo + ([ycor] of amigo - [ycor] of blanco) / 2 fd 0.1 end to get_amigo ifelse breed = rojos[set amigo one-of other rojos with [brigada = brigada]][set amigo one-of azules in-radius vision] end
There is only one version of this model, created over 1 year ago by Augusto Cabrera-Becerril.
Attached files
No files
This model does not have any ancestors.
This model does not have any descendants.