To get the desired program execution, a correct understanding on the use of logic operators ( AND, OR, XOR) as well as mathematical operators is essential so as to produce the correct results. Set pcolor ifelse-value (pxcor > 0) pcolor will either have blue or red depending on the reporter value (pxcor > 0) This can be used when a conditional is needed in the context of a reporter, where commands (such as ifelse) are not allowed. Netlogo ifelse mac os Netlogo ifelse Patch Netlogo ifelse software Netlogo ifelse code Netlogo ifelse download. With the use of ifelse-value, a specific variable can have a different value based on the value of the reporter. If FALSE, the result is the value of reporter2. If reporter's value is TRUE, the result is the value of reporter1. If pxcor > 0 agents with pxcor greater than 0 will be colored blue and agents with pxcor less than 0 will have red Ifelse reporter įor ifelse, if reporter's value is TRUE, it runs commands1. If pxcor > 0 agents with pxcor greater than 0 will be colored blue. With if, we expect some agents to run commands while others don't, this is because the reporter may have different value for different agents. The reporter must report a boolean (true or false) value. These are oftentimes used to change the properties of agents such as color, position, heading and other user-defined variables. In NetLogo, k nowing when to use if, ifelse, ifelse-value is important. When commands are to be executed conditionally, that is depending on the outcome of an evaluation, a selection control structure must be used.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |