## Inspiration

We were inspired by insects as we thought they were quite cool and are fascinating

## What it does

It kinda simulates how the movement of insects looks like from a distance

## How we built it

We built it soley using java as that is what we have the most expierence with

## Challenges we ran into

We originally wanted to make it a slime simulation but ran into some issues as the slimes did not behave properly so we scrapped that idea and turned parts of the old code into this

## Accomplishments that we're proud of

We are of the fact that we go something to actually work as this is our first hackathon

## What we learned

We to set more realalistic goals and improve our skills to tackle more complex project

## What's next for Bug Simulation animation

Turn it into the slime project we originally wanted to make

// The "Code" class. import java.awt.*; import hsa.Console;

public class Code { static Console c; // The output console

``````public static void main (String[] args)
{
c = new Console (130, 200);

int game = 1,
numSlimes = 500;
//2000 is doable at spee 1.5
//best on num <= 700
//goal is 5000
double[] angleSlimes = new double [numSlimes];
for (int w = 0 ; w < numSlimes ; w++)
angleSlimes [w] = (Math.random () * 360 + 1);

int h = 132, i = 260;
double[] [] grid = new double [i] [h];
double[] [] pos = new double [numSlimes] ;
for (int y = 0 ; y < 2 ; y++)
for (int x = 0 ; x < numSlimes ; x++)

pos [x] [y] = 0;

for (int y = 0 ; y < h ; y++)
for (int x = 0 ; x < i ; x++)
{
grid [x] [y] = 0;

//c.drawRect (5 * x, 5 * y, 5, 5);
}

c.setColor (Color.blue);
while (game != -1)
{
game++;

updateSlimes (game, numSlimes, angleSlimes, pos, grid);

if (game % 6 == 0)
c.clear ();

}
} // main method

public static void updateSlimes (int game, int numSlimes, double[] angleSlimes, double[] [] pos, double[] [] grid)
{

double speed = 1.5;
double[] position = new double ;

if (game == 2)

position = new double[]
{
499, 499
}
;
for (int n = 0 ; n < numSlimes ; n++)
{

for (int z = 0 ; z < 132 ; z++)
for (int a = 0 ; a < 260 ; a++)
{

if (grid [a] [z] > 0)
{
grid [a] [z] -= 1;
}

}

double[] direction = new double[]
{
(Math.cos (angleSlimes [n])), (Math.sin (angleSlimes [n]))
}
;

if (game > 2)

position = new double[]
{

pos [n] , pos [n] 
}

;

double[] newPosition = new double[]
{
(position  + (direction ) * speed), (position  + (direction ) * speed)
}
;

if (1 >= newPosition  || newPosition  >= (260 * 5) - 1 || 0 + 1 >= newPosition  || newPosition  >= 132 * 5 - 1)
{
newPosition  = (Math.min (260 * 5 - 0.1, Math.max (0, newPosition ))); //width
newPosition  = (Math.min (132 * 5 - 0.1, Math.max (0, newPosition ))); //high
do
angleSlimes [n] = (Math.random () * 360 + 1);
while (angleSlimes [n] > 360 || angleSlimes [n] < 0);

}

if ((0 + 1 < newPosition  && newPosition  < 260 * 5 - 1) && (0 + 1 < newPosition  && newPosition  < 132 * 5 - 1))
{

int[] shift = new int[]
{
0, 0
}
;
//update position in table
pos [n]  = newPosition ; //x
pos [n]  = newPosition ; //y

if (newPosition  > position )
shift  = 1;
else //if (newPosition  < position )
shift  = -1;
if (newPosition  > position )
shift  = 1;
else //if (newPosition  < position )
shift  = -1;

int[] e = new int[]
{
(int) Math.round (position ), (int) Math.round (position )
}
;
boolean ctr = true;
int index = 0;
while (ctr)
{
e [index] += shift [index];

c.fillRect (e , e , 2, 2);

if (shift [index] == 1 && e [index] >= Math.round (newPosition [index]))
index++;
else if (shift [index] == -1 && e [index] <= Math.round (newPosition [index]))
index++;
if (index > 1)
ctr = false;

}

//
/*
newPosition  = newPosition  / 5;
Math.round(newPosition );
int x = (int) newPosition ;

newPosition  = newPosition  / 5;
Math.round(newPosition );
int y = (int) newPosition ;

grid [x] [y] = grid [x] [y] + 6;
*/

//

}
}
}

public static void delay (int millisecs)  // Delay Method
{
try
{
}

catch (InterruptedException e)
{
}
}
``````

} // Code class