// Represent three swimming fish 	
	
import java.awt.*;	
	
public class ThreeSwimmingFish {	
	public static void main(String[] args) {	
		// set up the animation 	
		Aquarium aquarium = new Aquarium();	
		MovingFish[] fish = { new MovingFish(), new MovingFish(), 	
		                      new MovingFish() };	
	
		fish[0].setPosition(   0, 100);	
		fish[1].setPosition(  50, 200);	
		fish[2].setPosition(-150, 300);	
	
		Graphics g = aquarium.getGraphicsContext();	
		Color water = aquarium.getWaterColor();	
	
		Color[] c = new Color[fish.length];	
		for (int i = 0; i < fish.length; ++i) {	
			c[i] = fish[i].getColor();	
		}	
	
		// start the animation 	
		for (int i = 0; i < 1000; ++i) {	
			// erase the previous position 	
			for (int j = 0; j < fish.length; ++j) {	
				fish[j].setColor(water);	
				fish[j].paint(g);	
			}	
	
			// have each fish swim a stroke 	
			for (int j = 0; j < fish.length; ++j) {	
				fish[j].swim();	
			}	
	
			// paint the fish at their new positions 	
			for (int j = 0; j < fish.length; ++j) {	
				fish[j].setColor(c[j]);	
				fish[j].paint(g);	
			}	
	
			// pause to allow the movement to be perceived 	
			ez.Sleep.pauseMilliseconds(5);	
		}	
	}	
}	
	
