public class Foor3 implements Runnable{ int[][] fooriseisundid={ {1, 0, 0}, {1, 1, 0}, {0, 0, 1}, {0, 0, 2}, {0, 1, 0}, {0, 2, 0} //öine kollase vilkumine }; public Foor3(){ new Thread(this).start(); } boolean jatkata=true; int[] tavatsykkel={5000, 1000, 5000, 2000, 1000}; //millisekundid int fooriseisund=0; int kysiSeisund(){return fooriseisund;} int[] kysiTuled(){return fooriseisundid[fooriseisund];} void jargmineSeisund(){ fooriseisund++; if(fooriseisund>=tavatsykkel.length){fooriseisund=0;} } public void run(){ while(jatkata){ System.out.println(java.util.Arrays.toString(kysiTuled())); try{Thread.sleep(tavatsykkel[fooriseisund]);}catch(Exception ex){} jargmineSeisund(); } } public void seiska(){ jatkata=false; } }