1. NodeBox 1
    1. Homepage
    2. NodeBox 3Node-based app for generative design and data visualization
    3. NodeBox OpenGLHardware-accelerated cross-platform graphics library
    4. NodeBox 1Generate 2D visuals using Python code (Mac OS X only)
  2. Gallery
  3. Documentation
  4. Forum
  5. Blog

loop-ant

Posted by Karel on Nov 24, 2010

Dear,

How can I make a loop?
I'm working/learning on the ant-tutorial,
and I want to restart the action/script with the ants, when all food is taken.
So instead of step 4 (wander aimlessly), I want to restart the script.

Thank you!


 
Posted by Stefan on Nov 28, 2010

Hey, the trick is to restart the script when the foodsources count reaches zero. So you can put this in your draw() method, right after 'global colony':

if not colony.foodsources:
        setup()
Stefan