Links Property

See Also Applies To Example Model

Sets or returns a collection of object references. Read/write Group or Region.

Remarks

Links property sets or returns a Group object when applied to a Bot, or a Region object when applied to a Cell.

The Links property can be used to build a network of linked objects.

Example

The following example creates a circular network of linked Bot objects. Each of the 5 Bot objects references another Bot via the Links property. Then each Bot object moves towards the Bot it is linked to.

Bots.Create 5
Bots(1).Links.Add Bots(2)
Bots(2).Links.Add Bots(3)
Bots(3).Links.Add Bots(4)
Bots(4).Links.Add Bots(5)
Bots(5).Links.Add Bots(1)
For Each Bot in Bots
    Bot.TurnToward Bot.Links(1)
Next Bot
Bots.Step

The next example sets a Cell object's Links collection to reference the Cell object's surrounding neighbors.

Set Cell.Links = Cell.Adjacent8