package zh2015.vorosOktober;

import java.util.Random;

public class VorosOktober extends Ship {
	
	private boolean detect() {
		for (Ship e : Main.SU_ships)
			if (e.position.distance(this.position) < 10)
				return false;

		Random rand = new Random();
		for (Ship e : Main.US_ships)
			if (e.position.distance(this.position) < 10 && rand.nextInt(10) < 3)
				return true;
		
		return false;
	}
	
	@Override
	public void run() {
		while (!Main.success) {
			move();
			Main.success = detect();
			try {
				Thread.sleep(100);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
	}

}
