'=========================================================================== ' Subject: 3D STARFIELD SIMULATION Date: 06-09-96 (20:50) ' Author: John Wantland Code: QB, QBasic, PDS ' Origin: kwantlan@coffey.com Packet: GRAPHICS.ABC '=========================================================================== REM starfield n = 50 'number of stars DIM y(n) DIM x(n) DIM s(n) DIM c(n) DIM x1(n) DIM y1(n) DIM c1(n) DIM s1(n) RANDOMIZE TIMER SCREEN 12: CLS FOR i = 1 TO n x(i) = INT(RND * 640 + 1) y(i) = INT(RND * 480 + 1) s(i) = INT(RND * 5 + 1) s1(i) = INT(RND * 5 + 1) x1(i) = INT(RND * 640 + 1) y1(i) = INT(RND * 480 + 1) IF s1(i) <= 3 THEN c1(i) = 8 IF s1(i) = 4 THEN c1(i) = 7 IF s1(i) = 5 THEN c1(i) = 15 IF s(i) <= 3 THEN c(i) = 8 IF s(i) = 4 THEN c(i) = 7 IF s(i) = 5 THEN c(i) = 15 NEXT i DO FOR i = 1 TO n PSET (x(i), y(i)), 0 PSET (x1(i), y1(i)), 0 x(i) = x(i) - s(i) x1(i) = x1(i) - s1(i) IF x(i) <= 1 THEN GOSUB 2 IF x1(i) >= 640 THEN GOSUB 3 PSET (x(i), y(i)), c(i) PSET (x1(i), y1(i)), c1(i) a$ = INKEY$: IF a$ <> "" THEN END NEXT i LOOP 2 x(i) = 640 y(i) = INT(RND * 480 + 1) RETURN 3 x1(i) = 1 y1(i) = INT(RND * 480 + 1) RETURN