在不同地区设置海龟的能量会有所不同

时间:2016-05-14 14:18:23

标签: netlogo energy

在NetLogo中,我有3个方面:

to setup-patches


ask patches [ if pxcor > 6   
    [set pcolor yellow
    ]
  ]
  ask patches [ if pxcor <= 6
    [set pcolor green
    ]
  ]
    ask patches [ if pxcor < -6
    [set pcolor blue
    ]
  ]
end

我希望我的3种不同种类的海龟中的2种能够在其中一个区域(例如ycor > 6中)更快地失去能量,例如set energy energy - 1 [ -6 if xcor <= 6]

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:mongo="http://www.springframework.org/schema/data/mongo"
       xsi:schemaLocation="http://www.springframework.org/schema/data/mongo http://www.springframework.org/schema/data/mongo/spring-mongo.xsd
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

    <mongo:mongo-client credentials="user:password@database" />

    <bean id="mongoTemplate" class="org.springframework.data.mongodb.core.MongoTemplate">
        <constructor-arg name="mongo" ref="mongo"/>
        <constructor-arg name="databaseName" value="myDBName"/>
    </bean>
</beans>

但这不起作用。

1 个答案:

答案 0 :(得分:1)

尝试:

ask patches with [pxcor > 6] [set pcolor yellow]
ask patches with [pxcor <= 6] [set pcolor green]
ask patches with [pxcolor < -6] [set pcolor blue]

然后,如果能量是乌龟变量。

ask turtles 
[
   if yellow = pcolor [set energy energy - 1]
   if green = pcolor [set energy energy - 2]
   if blue = pcolor [set energy energy - 3]

]