//coolest: nxterm -font nil2 maximize it, then run this with ~ 500 1000 import java.io.*; public class AnsiscreenEx2 { static final int numcolors=8; public static void main(String[] args) { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String line; /* try { line = in.readLine(); } //so don't need throws IOException (from readLine) for method catch (IOException e) { System.out.println("catch Exception"); } */ int rows, cols; int x, y; java.util.Random rand = new java.util.Random(System.currentTimeMillis()); /* if (args.length == 2) { rows = atoi(argv[1]); cols = atoi(argv[2]); } else { cout << "Enter number of rows of your screen: "; cin >> rows; cout << "Enter number of columns of your screen: "; cin >> cols; } */ rows = 20; cols = 50; Ansiscreen.clearsc(); while (true) { x = rand.nextInt(rows) +1; y = rand.nextInt(cols) +1; Ansiscreen.gotoxy(x,y); switch (rand.nextInt(numcolors)) { case 0: Ansiscreen.colorback_black(); break; case 1: Ansiscreen.colorback_red(); break; case 2:Ansiscreen.colorback_green(); break; case 3:Ansiscreen.colorback_yellow(); break; case 4:Ansiscreen.colorback_blue(); break; case 5:Ansiscreen.colorback_magenta(); break; case 6:Ansiscreen.colorback_cyan(); break; case 7:Ansiscreen.colorback_white(); break; } System.out.print(" "); } } }