My turtles are firms and they have a turtles-own which is a profit varying from firm to firm, as well as offshored? and reshored? which is either true or false.
There is something not right about the code. I struggle with combining the IF and the AND command. IF the parameter of the label offshored? reports = true AND the profit of any of these firms is lower than the profit of the firms which report offshored? = false, than they are supposed to move. The moving section of the code works alright. Please find the (error-reporting) code I have so far below:
breed [ firms firm ]
firms-own [
profit
offshored? ;; reports either true or false
reshored? ;; reports either true or false
]
to setup
ask firms [
if offshored? true AND profit < [ profit ] of firms with [ offshored? = false ] [ ;; if the profit of an offshored firm is smaller than the lowest profit of firms at home, the decision to reshore is yes!
ask one-of turtles [ move-to one-of patches with [ pcolor = 58 and not any? turtles-here ] ] ;; the firm reshores
AND set reshored? true ] ] ;; the firm is now labelled as reshored
end