Lanchester Guerrilla warfare I
No preview image
Model was written in NetLogo 6.4.0
•
Viewed 71 times
•
Downloaded 2 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
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 5 months ago by Augusto Cabrera-Becerril.
Attached files
No files
This model does not have any ancestors.
This model does not have any descendants.