0

how can i make a precise procedure every 30 ticks?I have written this procedure in "to go". i tried to write like this:

    'to go
     if count population with [underPovertyLine] = count population   or 
     count firms = 0 [stop]

     ask population [
     set min-indiv-cost-of-living  runresult  [max-indiv-cost-of-living]
     ]

    if ticks mod 30 = 0 [
    ask population with [employed = false and color = grey] [
    set mymoneyOnBankOfGrey runresult [moneyOnBankOfGrey -  min-indiv- 
    cost-of-living]
    if  mymoneyOnBankOfGrey < 0 [die]
    ]
    ask population with [employed = false and color = blue ] [
    set mymoneyOnBankOfBlue runresult[ moneyOnBankOfBlue - min-indiv-cost- 
    of-living]
    if   mymoneyOnBankOfBlue < 0 [die]
    ]
   ask population with [employed = false and color = red] [
   set mymoneyOnBankOfRed runresult [ moneyOnBankOfRed - min-indiv-cost- 
   of-living]
  if  mymoneyOnBankOfRed < 0 [die]
  ]

   ask population with [employed = true and color = grey] [
   set mymoneyOnBankOfGrey runresult[ moneyOnBankOfGrey + wage - min- 
   indiv-cost-of-living]
    if  mymoneyOnBankOfGrey < 0 [die]
   ]
   ask population with [employed = true and color = blue] [
   set mymoneyOnBankOfBlue runresult [ moneyOnBankOfBlue + wage - min- 
   indiv-cost-of-living]
  if   mymoneyOnBankOfBlue < 0 [die]
  ]
  ask population with [employed = true and color = red ] [
  set mymoneyOnBankOfRed runresult [ moneyOnBankOfRed + wage - min-indiv- 
  cost-of-living]
    if  mymoneyOnBankOfRed < 0 [die]
  ]


  ]
  tick
  end'  
    

I would like the procedure to take place every 30 ticks but it happens only 1 time at the 30th tick and it stops and it does not update. how can i fix it?? thanks!!

  • the second one should work. can you show us more of you go procedure? – JenB Dec 16 '20 at 08:52
  • @JenB sure. i'll update the post with the code. it's too long to put it in the comment. again thanks – Elena Lisco Dec 16 '20 at 15:38
  • Comment out your first line with the `stop` and see what happens. It looks to me as if that line is stopping the code and the problem has nothing to do with `mod` – JenB Dec 16 '20 at 21:54
  • @JenB I deleted all that line, still nothing....thanks anyway! maybe the flaw is somewhere else – Elena Lisco Dec 16 '20 at 22:58
  • so after deleting, the code still stops running after awhile? if so, you must have something else in your code that tells the 'go' procedure to stop. or is that not the problem? – JenB Dec 17 '20 at 11:46
  • the ticks continue to flow but the procedure I put in the brackets of the 'if ticks mod 30 = 0 []' occur only once. and the code ends here for now because I still have to finish it...but if I don't solve it there is no sense to go on because the model is based on changes in the environment over time. – Elena Lisco Dec 17 '20 at 14:16
  • 1
    Then I suggest you change the line to `if ticks mod 30 = 0 [ type "Current ticks: " print ticks ]` to see whether it is a `mod` issue or the procedure that is supposed to occur is the problem – JenB Dec 17 '20 at 15:30
  • still nothing! thank you very much for your patience and support :) 'if ticks mod 30 = 0 [ type "Current ticks: " print ticks ]' is a procedure that I really didn't know and that could be useful in the future! – Elena Lisco Dec 17 '20 at 16:35

0 Answers0