Program: bigbang.bas

Implementation Select: Implementation
Operation Select: Program: BIGBANG.BAS
DEFDBL A-Z
'              BIGBANG.BAS
'                                Revision 1.0          16 Dec 1995
'            Added small expansion factor              15 Jul 2004            
DECLARE SUB GETSCREEN ()
DECLARE SUB SETSTANDARD ()
DECLARE SUB INITIALISE ()

CONST pi = 3.141592653589#
CONST pi2 = 2 * pi
CONST left = 75, right = 77, ESC = 27, up = 72, down = 80
CONST blue = 1

DIM SHARED r0(200), phi0(200), x0(200), y0(200)
DIM SHARED x1(200), y1(200)
DIM SHARED kleur(16)
DIM SHARED posmax, c, x0
DIM SHARED scren%, typetr
DIM SHARED xmax, ymax, xchrmax, ychrmax, fract
DIM SHARED waittim, delta, test%
null$ = CHR$(0)                        ' See page 191
SCREEN 12
CLS : COLOR 7
nc = 1' 15
INITIALISE
DO
LOCATE 1, 1: INPUT "Expansion factor > 0 "; nc
IF nc <= 0 THEN END
CLS
LOCATE 1, 56: COLOR 7:
PRINT "Expansion factor "; nc

FOR i = 1 TO 15
  LOCATE i + 4, 1: COLOR kleur(i)
  PRINT USING "##"; i - 1;
  PRINT " -"; i
NEXT i
COLOR 7
nstar = 150
FOR i = 0 TO nstar:
  phi0(i) = RND(1) * pi2
  r0(i) = .99# * i / nstar
NEXT i
phi0(1) = pi / 2: phi0(2) = pi: phi0(3) = 1.25 * pi
x0dis = xmax / 2
y0dis = ymax / 2
Rdismax = y0dis - 10
colori = Rdismax / 15
FOR Rdis = 1 TO Rdismax
   time1 = TIMER + .3
   Age = Rdis / colori
   colour = kleur(INT(Age) + 1)
   IF colour > 15 THEN colour = 15
   DO: LOOP UNTIL TIMER > time1
   CIRCLE (x0dis, y0dis), Rdis - 1, 0      ' black
   CIRCLE (x0dis, y0dis), Rdis, blue
   FOR i = 0 TO nstar
     'PSET (x0dis + x0(i), y0dis + y0(i)), 0    ' black
     x0(i) = Rdis * r0(i) * SIN(phi0(i)):
     y0(i) = Rdis * r0(i) * COS(phi0(i))
     'PSET (x0dis + x0(i), y0dis + y0(i)), colour
    
     Rdis1 = Rdis * nc * r0(i) / (1 + nc * r0(i))
     Age1 = Age * nc * r0(i) / (1 + nc * r0(i))     ' past from now
     Age1 = Age - Age1                              ' from 0
     colour1 = kleur(INT(Age1) + 1)
     PSET (x0dis + x1(i), y0dis + y1(i)), 0    ' black
     x1(i) = Rdis1 * SIN(phi0(i)):
     y1(i) = Rdis1 * COS(phi0(i))
     PSET (x0dis + x1(i), y0dis + y1(i)), colour1
    
   NEXT i
   COLOR colour:
   LOCATE 1, 1: PRINT USING "Age ##.#"; Age;
   PRINT " GYr"
NEXT Rdis
DO: a$ = INKEY$: LOOP UNTIL a$ <> ""
LOOP

DEFSNG P
SUB GETSCREEN
'                                                                   GETSCREEN
SELECT CASE scren%
CASE 7
   xmax = 320: ymax = 200
   r = 60: fract = 1.2
   xchrmax = 40: ychrmax = 25
CASE 8
   xmax = 640: ymax = 200
   r = 60: fract = 2.4
   xchrmax = 80: ychrmax = 25
CASE 9
   xmax = 640: ymax = 350
   r = 115: fract = 1.368
   xchrmax = 80: ychrmax = 25
CASE 12
   xmax = 640: ymax = 480
   r = 150: fract = 1
   xchrmax = 80: ychrmax = 30
CASE ELSE
   nscren% = scren%: PRINT "SCREEN ERROR, not 7, 8, 9 or 12"
END SELECT

EXIT SUB

END SUB

SUB INITIALISE
'                                                                   INITIALISE
delta = .1                            'display factor for vx and vy
waittim = .1                          'wait time in seconds
scren% = 12                           'screen mode 9
c = 30                                'speed of light
x0 = 1000
FOR i = 0 TO 15: kleur(i) = i: NEXT i
kleur(16) = 15
kleur(3) = 4
kleur(4) = 3
kleur(11) = 12
kleur(12) = 11
GETSCREEN

END SUB



Back to my home page Contents of This Document