Intelligent Footballists

Intelligent Footballists preview image

1 collaborator

Default-person Hossein Sabzian (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 6.0.1 • Viewed 462 times • Downloaded 37 times • Run 0 times
Download the 'Intelligent Footballists' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


WHAT IS IT?

This model shows how two football players can pass ball to each other and change their positions.

HOW IT WORKS

player A shoots the ball to a random place and the player B moves there and shoots it back to another random place. They do such a behavior again and again.

HOW TO USE IT

shoot-speed slider: it is for setting the value of shoot speed

setup: it is for initialising the model

go: it is for running the model

THINGS TO NOTICE

view updates are on ticks (discrete)

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

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

breed [players player]
breed [balls ball]
players-own [rival spaces movable?]
globals [ target speed]

to setup
  ca
  resize-world -40 40 -10 10
  ask patches [ set pcolor green ]
  create-balls 1 [ set color white set shape "circle"]
  create-players 2 [ set color red set rival one-of other players set shape "person" set size 3]
  ask player 1 [ setxy 30 0      set movable? false       set spaces patches with [pxcor = 30] ]
  ask player 2 [ setxy -30 0     set movable? false        set spaces patches with [pxcor = -30] ]
  ask ball 0 [ move-to [patch-here] of one-of players ]
  set speed shoot-speed
  set target "nobody"
  reset-ticks
end 

to go



  ask players [

             if any? balls-on patch-here [

                                          set-target
                                          ask balls [face target ]
                                          set movable? false
                                          ask rival [ set movable? true face target]

                                                                                    ]

                                                                                      ]
  ask players with [ movable? ]  [ if patch-here != target [ fd 1]]


  ask balls [ if patch-here != target [fd 1]        ]

  tick
end 

to set-target
  set target one-of [spaces] of rival
end 

There is only one version of this model, created almost 5 years ago by Hossein Sabzian.

Attached files

File Type Description Last updated
Intelligent Footballists.png preview Preview for 'Intelligent Footballists' almost 5 years ago, by Hossein Sabzian Download

This model does not have any ancestors.

This model does not have any descendants.