10 REM--A.C.CAGGIANO+E.A.GALLETTA, PATCHOGUE H.S., 11-20-68 
11 REM--REVISED BY CHARLES LOSIK AND TONY PEREZ 7/18/69 
12 REM RE-REVISED BY C.LOSIK 8-26-70
20 REM--THIS PROGRAM IS ASSOCIATED WITH CLOUD FORMATION 
25 REM PHASE I OF PROGRAM BEGINS HERE. STUDENTS WILL BE GIVEN
26 REM INTRODUCTORY INFORMATION AND BE ALLOWED TO ASK AND ANSWER 
27 REM ANY NUMBER OF PROBLEMS. WHEN THEY INPUT NO. 2 (LINES 554-556) 
28 REM PROGRAM SENDS THEM TO PHASE II (LINE 561 AND FOLLOWING). 
30 PRINT" ","CLOUD NINE" 
40 PRINT" ","===== ====" 
45 DIM B(2), T(4), Q(3), A(3), C(3) 
50 PRINT 
60 PRINT" STRONG CONVECTION CURRENTS ARE CAUSING ADIABATIC" 
70 PRINT"COOLING OF AIR WHERE YOU ARE AND ARE RESPONSIBLE FOR THE"
80 PRINT"FORMATION OF A CLOUD. BOTH THE DRY AND THE MOIST ADIABATIC" 
90 PRINT"(AS WELL AS THE NORMAL LAPSE RATES) ARE CONSIDERED IN THIS" 
91 PRINT"PROGRAM."
100 PRINT 
105 PRINT 
110 PRINT" ","LEGEND" 
120 PRINT" ","======" 
140 PRINT"1="; 
150 GOSUB 1000
160 PRINT"2="; 
170 GOSUB 1010
180 PRINT"3="; 
190 GOSUB 1020 
200 PRINT"4="; 
210 GOSUB 1030 
220 PRINT 
225 PRINT 
230 PRINT"CHOOSE ANY TWO OF THE ABOVE VARIABLES AND SELECT VALUES FOR" 
231 PRINT"THEM. TYPE THEM IN AS:" 
232 PRINT"VARIABLE CODE ,VALUE, VARIABLE CODE ,VALUE...(E.G. 1,50,2,30)" 
233 PRINT 
240 X=0
242 Y=0
245 A=0
246 B=0
247 B(1)=0 
248 B(2)=0 
250 INPUT B(1),A,B(2),B 
290 PRINT 
300 FOR I=1 TO 4 
310 IF B(1)=I THEN 330
320 NEXT I 
330 T(I)=A 
340 FOR J=1 TO 4 
350 IF B(2)=J THEN 370
360 NEXT J 
370 T(J)=B 
380 IF I<>J THEN 405 
390 PRINT"YOU CAN'T USE THE SAME VALUES TWICE."
395 GOTO 250
405 PRINT"OKAY, TYPE IN YOUR CALCULATED VALUE FOR";
406 PRINT 
410 IF J*I<>2 THEN 425
411 T=(T(1)-T(2))/4.5 
412 T(4)=1000*T 
413 T(3)=T(2)-T 
414 GOSUB 1020 
415 GOSUB 1050 
416 GOSUB 1030 
417 INPUT X,Y 
418 IF ABS(X-T(3))>=.6 THEN 500 
419 IF ABS(Y-T(4))>=.6 THEN 500 
420 GOTO 550
425 IF J*I<>3 THEN 440
426 T=(T(1)-T(3))/5.5 
427 T(4)=1000*T 
428 T(2)=T+T(3) 
429 GOSUB 1010 
430 GOSUB 1050 
431 GOSUB 1030 
432 INPUT X,Y 
433 IF ABS(X-T(2))>=.6 THEN 500 
434 IF ABS(Y-T(4))>=.6 THEN 500 
435 GOTO 550
440 IF J*I<>4 THEN 455
441 T=T(4)/1000 
442 T(2)=T(1)-4.5*T 
443 T(3)=T(2)-T 
444 GOSUB 1010 
445 GOSUB 1050 
446 GOSUB 1020 
447 INPUT X,Y 
448 IF ABS(X-T(2))>=.6 THEN 500 
449 IF ABS(Y-T(3))>=.6 THEN 500 
450 PRINT"OKAY, TYPE IN YOUR CALCULATED VALUE FOR" 
455 IF J*I<>6 THEN 470
456 T=T(2)-T(3) 
457 T(4)=1000*T 
458 T(1)=T(3)+5.5*T 
459 GOSUB 1000 
460 GOSUB 1050 
461 GOSUB 1030 
462 INPUT X,Y 
463 IF ABS(X-T(1))>=.6 THEN 500 
464 IF ABS(Y-T(4))>=.6 THEN 500 
465 GOTO 550
470 IF J*I<>8 THEN 485
471 T=T(4)/1000 
472 T(3)=T(2)+T 
473 T(1)=T(2)+6.5*T 
474 GOSUB 1010 
475 GOSUB 1050 
476 GOSUB 1020 
477 INPUT X,Y 
478 IF ABS(X-T(1))>=.6 THEN 500 
479 IF ABS(Y-T(3))>=.6 THEN 500 
480 GOTO 550
481 IF ABS(X-T(3))>=.6 THEN 500 
485 IF J*I<>12 THEN 390 
486 T=T(4)/1000 
487 T(1)=T(3)+5.5*T 
488 T(2)=T(3)+T 
489 GOSUB 1000 
490 GOSUB 1050 
491 GOSUB 1010 
492 INPUT X,Y 
493 IF ABS(X-T(1))>=.6 THEN 500 
494 IF ABS(Y-T(2))>=.6 THEN 500 
495 GOTO 550
500 PRINT 
502 PRINT"IT LOOKS LIKE WE GOOFED SOME PLACE." 
505 PRINT"LET'S SEE WHAT THE CORRECT VALUES ARE." 
507 PRINT 
510 PRINT T(1);"DEGREES - "; 
512 GOSUB 1000
515 PRINT T(2);"DEGREES - "; 
517 GOSUB 1010
520 PRINT T(3);"DEGREES - "; 
522 GOSUB 1020
525 PRINT T(4);"FEET - "; 
527 GOSUB 1030
530 PRINT 
535 GOTO 554
550 PRINT 
552 PRINT"VERY GOOD. VERY, VERY GOOD."
553 PRINT 
554 PRINT"DO YOU HAVE ANY OTHER PROBLEMS YOU WOULD LIKE TO TRY?" 
555 PRINT "(1=YES, 0=NO) : "; 
556 INPUT P
557 IF P<1 THEN 561 
558 PRINT 
559 PRINT"USING THE SAME LEGEND AS BEFORE..." 
560 GOTO 230
561 H=(T(1)-T(3))*2000-7*T(4) 
562 REM LINE 561 CALCULATES ALTITUDE FOR TOP OF CLOUD AND BEGINS 
563 REM PHASE II OF PROGRAM. PROBLEM NO.2 IN THIS PART (CALCULATION 
564 REM OF TEMP. ABOVE CLOUD TOP) INVOLVES USE OF THE NORMAL LAPSE RATE. 
565 PRINT 
567 PRINT"WELL, BEFORE YOU LEAVE, I HAVE A FEW I'D LIKE YOU TO TRY..." 
570 PRINT"BASED ON YOUR VALUES, THE HEIGHT OF THE CLOUD" 
580 PRINT"(MEASURED FROM THE CLOUD BASE) IS ";H;"FT. CAN YOU TELL ME:"
600 Q(1)=.7*T(4)
601 Q(2)=T(4)+1.5*H 
602 Q(3)=T(4)+.5*H 
610 A(1)=T(1)-T(4)*3.85E-03 
611 A(2)=T(1)-(T(4)+1.5*H)*3.5E-03 
612 A(3)=T(3)-1.5E-03*H 
614 PRINT 
615 PRINT"WHAT IS THE TEMPERATURE AT EACH OF THESE ALTITUDES:" 
620 FOR N=1 TO 3 
625 PRINT" ",N;INT(Q(N)+.5);"FT" 
627 NEXT N 
628 PRINT 
629 FOR N=1 TO 3
630 PRINT"THE TEMPERATURE AT ";INT(Q(N)+.5);" FT. IS ";
631 INPUT C(N) 
635 IF ABS(C(N)-A(N))>1.1 THEN 750
640 NEXT N 
699 PRINT 
700 PRINT"WOW, YOU MUST BE A BRAIN. AND YOU PROBABLY KNOW"
710 PRINT"A LOT ABOUT CLOUDS AND THINGS LIKE THAT. IT WAS VERY" 
720 PRINT"NICE TO WORK WITH SOMEONE WHO UNDERSTANDS ME." 
730 PRINT" ","THANK YOU AND . . . . PEACE AND LONG LIFE" 
740 end
750 PRINT 
755 PRINT"SORRY. YOU WERE DOING GREAT THERE FOR A WHILE." 
760 PRINT"WELL, BACK TO THE BOOKS. THE VALUES YOU SHOULD HAVE ARE:" 
765 PRINT 
770 FOR N=1 TO 3 
774 PRINT N;
780 PRINT"THE TEMPERATURE AT";INT(Q(N)+.5);"FEET IS ";A(N);"DEGREES" 
790 NEXT N
830 end
1000 PRINT"THE TEMPERATURE ON THE GROUND" 
1005 RETURN 
1010 PRINT"THE DEW POINT TEMPERATURE ON THE GROUND" 
1015 RETURN 
1020 PRINT"THE TEMPERATURE AT THE BASE OF THE CLOUD"
1025 RETURN 
1030 PRINT"THE ELEVATION, IN FEET, OF THE CLOUD BASE" 
1035 RETURN 
1050 PRINT"FOLLOWED BY A COMMA, AND THEN TYPE IN YOUR VALUE FOR "
1055 RETURN 
2000 END
