import processing.core.*; @SuppressWarnings("serial") public class AutonomousAgentsOne extends PApplet { private int TOTAL_ANTS = 2500; private int MULTIPLIER = 4; private Ant [] _ants; private boolean [][] _pixels; public static void main(String args[]) { PApplet.main(new String[] { "--present", "AutonomousAgentsOne" }); } public void setup() { size( 600, 600 ); background( 0 ); frameRate( 50 ); colorMode( HSB ); _ants = new Ant [ this.TOTAL_ANTS ]; initPixels(); initAnts(); } private void initPixels() { _pixels = new boolean [ width ][ height ]; for ( int i = 0; i < width; i++ ) { for ( int j = 0; j < height; j++ ) { _pixels[ i ][ j ] = false; } } } private void initAnts() { Ant tAnt; int tInt = 100; float tXv; float tYv; float tR; for ( int i = 0; i < this._ants.length; i++ ) { tXv = round( random( ( width / 2 - 50 ), ( width / 2 + 50 ) ) ); tYv = round( random( ( height / 2 - 50 ), ( height / 2 + 50 ) ) ); tR =round( tXv/MULTIPLIER ); tXv = ( tR * MULTIPLIER ); tR = round( tYv/MULTIPLIER ); tYv = ( tR * MULTIPLIER ); tAnt = new Ant( this, tXv, tYv, color( 10, tInt, tInt / 2, 100 ), color( 342, tInt, tInt / 2, 5 ), MULTIPLIER ); _ants[ i ] = tAnt; tInt += 1; if ( tInt > 360 ) { tInt = 1; } } } public void draw() { Ant tAnt; for ( int i = 0; i < this._ants.length; i++ ) { tAnt = _ants[ i ]; tAnt.moveAnt(); } } public void setPixel( int tColor, float xV, float yV ) { stroke( color( tColor ) ); point( xV, yV ); } public boolean[][] get_pixels() { return this._pixels; } }