# NodeBox

Create visual output with Python programming code
Home Download Reference Tutorial Library Gallery About

# ants.colony()

## Syntax

    colony(n, x, y, r)

## Description

Returns a new ant colony consisting of n ants. The colony's location is at coordinates x and y and has a territorial radius of r. Once ants venture beyond r they will turn back to the colony.

The colony has three useful properties:

- colony.ants: a list of ants in the colony.
- colony.foodsources: a list of food() sources inside the colony's territory which the ants can discover.
- colony.food: a number indicating the amount of food harvested.

## Example

    ants = ximport("ants")
    colony = ants.colony(30, WIDTH/2, HEIGHT/2, 100)