Jednoliko pravocrtno gibanje s vise automobila

Jednoliko pravocrtno gibanje s vise automobila preview image

1 collaborator

Default-person Hrvoje Mladinić (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by the author
Model was written in NetLogo 5.0.2 • Viewed 259 times • Downloaded 34 times • Run 0 times
Download the 'Jednoliko pravocrtno gibanje s vise automobila' 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 [automobili automobil]

turtles-own 
[d_x]

automobili-own
[v_a]

globals
[s v B d_t a_d_x a_s]

to setup
  clear-all
  setup-cestica
  setup-pozadina
  reset-ticks
end 

to setup-pozadina
   set B random 30
   ask patch 0 0 
   [
     set pcolor white
     set plabel "A"
     set plabel-color red
   ]
   ask patch B 0 
   [
     set pcolor white
     set plabel "B"
     set plabel-color red
   ]
end 

to setup-cestica
  ifelse (vise_automobila?)
  [
    create-automobili 8
    ask automobili
    [
      setxy 0 who
      set color (2 * who + 1) * 5
      set shape "car"
      set heading 90
      set v_a random 200
      if putanja? 
      [
        pen-down
      ]
    ]
  ]
  
  [
    create-turtles 1
    ask turtle 0 
    [
    set color red
    setxy 0 0
    set heading 90
    set shape "car" 
    if putanja? 
    [
      pen-down
    ]
    ]
  ]
end 

to go
  ifelse (vise_automobila?)
  [
  ask automobili
  [
    ifelse xcor <= B
    [
      automobili-unos
      automobili-izracun 
    ]
    
    [
      set v_a 0
    ]
    
  ]
  ]
  
  [
  ask turtle 0 
  [
  ifelse xcor <= B
  [
  unos
  izra_un
  ]
  
  [ 
  set v 0
  ]
  ]
  ]
  tick  
end 

to unos
    set v brzina
    set d_t 0.001
end 

to izra_un 
  set d_x (v * d_t)
  set xcor (xcor + d_x) 
  set s (s + d_x)
end 

to automobili-unos
  set d_t 0.001
end 

to automobili-izracun
  set a_d_x (v_a * d_t)
  set xcor (xcor + a_d_x)
end 

  
  

There is only one version of this model, created over 12 years ago by Hrvoje Mladinić.

Attached files

File Type Description Last updated
Jednoliko pravocrtno gibanje s vise automobila.png preview Preview for 'Jednoliko pravocrtno gibanje s vise automobila' about 12 years ago, by Hrvoje Mladinić Download

This model does not have any ancestors.

This model does not have any descendants.