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 139 times • Downloaded 6 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.)


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 3 months ago by Hossein Sabzian.

Attached files

File Type Description Last updated
Intelligent Footballists.png preview Preview for 'Intelligent Footballists' 3 months ago, by Hossein Sabzian Download

This model does not have any ancestors.

This model does not have any descendants.