Lanchester III
No preview image
Model was written in NetLogo 6.4.0
•
Viewed 89 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] breed[rojos rojo] breed[azules azul] to setup clear-all ask patches [set pcolor green - random-float 2] create-rojos R[set shape "person" set color red 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 rojos in-radius vision 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 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 dispara apunta if random-float 1 > efectividad[if blanco != nobody [ask blanco [die]]] apunta end to mueve 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 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 rojos in-radius vision][set amigo one-of azules in-radius vision] end
There is only one version of this model, created 8 months ago by Augusto Cabrera-Becerril.
Attached files
No files
This model does not have any ancestors.
This model does not have any descendants.