Cells Object

See Also Properties Methods Events Model
World
Cells
Cell
Region

The collection of all Cell objects.

Using the Cells Object

The Cells collection object can be used to manipulate all Cell objects through the use of its properties and methods.

The At method is the default property for the Cells collection object if two parameters are supplied. If only one parameter is supplied, then the default property is the Item method.

Example

The following example creates a checkered board pattern using the Cell object and the Cells collection object.

Private Sub World1_OnSimBegin(ByVal World As World, ByVal Worms As Bots, ByVal Cells As Cells)
Cells.Color = vbtBlack
For Each Cell in Cells
     If IsEven(Cell.RowIndex + Cell.ColumnIndex) then
          Cell.Color = vbtRed
     End If
Next Cell
End Sub

Function IsEven(ByVal Number as Long) as Boolean
     If Number Mod 2 = 0 Then IsEven = true Else IsEven = false
End Function