MaDKit forum

Welcome All !
Please, use explicit topic names when creating new threads. Thanks.

You are not logged in.

#1 2011-10-03 15:42:59

lois.vanhee
Member
Registered: 2011-10-03
Posts: 12

Patch information

Dear all,

In NetLogo, we can very easily add information on patches (in basic examples, the size of the grass for instance). In TK, I tried to do the same in extending the Patch class, but it appeared to be final. My current solution consists in handling it externally (with a patch manager class) but does not appear to be very elequant.

Is there a way to do it more properly ?

Thank you for your help,

Offline

#2 2011-10-04 10:43:53

fmichel
Administrator
From: Montpellier
Registered: 2009-03-24
Posts: 172
Website

Re: Patch information

Hi,

in TK 2.4.7, there are two ways to put information on the patch grid :

(1) double valued information : define a pheronome in the xml file (name and parameters) and then use the smell and emit methods of the Turtle class to get and modify the information during the simulation. For such a use, the edu.turtlekit2.demos.ants demo source code should help.

(2) any java object can be put on a patch using Turtle.dropMark(String, Object), the name should be use later on to access this object.

Offline

#3 2011-10-04 12:42:21

lois.vanhee
Member
Registered: 2011-10-03
Posts: 12

Re: Patch information

Great, this will simplify a lot my work. Thank you !

Offline

Board footer