10 CLOSE 20 OPEN "I",1,"PARA.DAT" 30 INPUT #1, CLRSCRN 40 CLOSE #1 50 CL$=CHR$(CLRSCRN) 100 ' DECIDE 150 CLEAR 500 160 MD=10 170 DIM L$(MD),F$(MD),V(MD),C(MD,MD),D(MD),Z(MD) 180 E$="END" 200 GOSUB 2000 205 PRINT " (Please depress CAPS LOCK key)" 210 PRINT:PRINT" I can help you make a decision. All I need to do is ask" 220 PRINT"some questions and then analyze the information you give." 230 PRINT:PRINT TAB(8);STRING$(44,"-"):PRINT 240 PRINT"Which of these best describes the type of decision facing you?" 250 PRINT:PRINT" 1) Choosing an item from various alternatives." 260 PRINT" 2) Choosing a course of action from various alternatives." 270 PRINT" 3) Making a 'YES' or 'NO' decision." 280 PRINT:PRINT"Which one (1,2, OR 3)?": 290 R$=INKEY$:IF R$="" THEN 290 300 T=VAL(R$): IF T<1 OR T>3 THEN 290 350 PRINT T:GOSUB 2000 400 FOR J=1 TO 9:R$=INKEY$:NEXT:ON T GOTO 410,440,470 410 PRINT"What type of item must you decide upon" 420 INPUT T$:GOTO 500 440 T$="Course of action":GOTO 500 470 T$="'YES' OR 'NO'" 480 NI=2:L$(1)="Deciding YES":L$(2)="Deciding NO" 490 GOTO 750 500 GOSUB 2000;NI=0 510 PRINT" I need to have a list of each" 520 PRINT T$;" under consideration.":PRINT 530 PRINT" Input them one at a time in response to each question mark." 540 PRINT"The order in which you input them has no special significance." 550 PRINT:PRINT" Type the word '";E$;"' to indicate the whole list" 560 PRINT"has been entered.":PRINT 580 IF NI>=MD THEN PRINT"--LIST FULL--":GOTO 620 590 NI=NI+1:INPUT L$(NI) 600 IF L$(NI)<>E$ THEN 580 610 NI=NI-1 620 IF NI>=2 THEN 650 630 PRINT:PRINT"You must have at least 2 choices !": 640 PRINT"Try again":GOSUB 2100:GOTO 500 650 GOSUB 2000:PRINT"O.K. Here's the list you've given me:":PRINT 660 FOR J=1 TO NI:PRINT" ";J;CHR$(24);") ";L$(J):NEXT:PRINT 670 FOR J=1 TO 9:R$=INKEY$:NEXT:PRINT"Is this list correct (Y OR N) ? "; 680 R$=INKEY$:IF R$="" THEN 680 690 IF R$="Y" THEN PRINT"YES":GOTO 750 700 IF R$="N" THEN PRINT"NO" 710 IF R$="N" THEN PRINT:PRINT"The list must be re-entered" 720 IF R$="N" THEN GOSUB 2100:GOSUB 500 730 GOTO 680 750 GOSUB 2000:FOR J=1 TO 9:R$=INKEY$:NEXT 760 PRINT" Now, think of the different factors" 770 IF T<3 THEN PRINT"that are important to you in choosing" 780 IF T<3 THEN PRINT"the best ";T$;"." 790 IF T=3 THEN PRINT"that are important to you in deciding ";T$;"." 800 PRINT:PRINT" Input them one at a time in response to each" 810 PRINT"question mark.":PRINT 820 PRINT" Type the word '";E$;"' to terminate the list." 830 PRINT:NF=0 835 IF NF>=MD THEN PRINT"--LIST FULL--":PRINT:GOTO 870 840 NF=NF+1:INPUT F$(NF) 850 IF F$(NF)<>E$ THEN 835 860 NF=NF-1:PRINT 870 IF NF<1 THEN PRINT"You must have at least one! --Redo it" 880 IF NF<1 THEN GOSUB 2100:GOTO 750 890 GOSUB 2000:PRINT"Here's the list of factors you gave me:':? 900 FOR J=1 TO NF:PRINT" ";J;CHR$(24);") ";F$(J):NEXT:PRINT 910 PRINT" Decide which factor on the list is the most important" 920 PRINT"and input it's number. (Type '0' if the list needs changing.)" 930 PRINT 940 INPUT A:A=INT(A):IF A=0 THEN 750 950 IF A>NF OR A<0 THEN 890 1000 GOSUB 2000:IF NF=1 THEN 1200 1010 PRINT" Now let's suppose we have a scale of importance" 1020 PRINT"ranging from 0-10." 1030 PRINT:PRINT" We'll give ";F$(A);" a" 1040 PRINT"value of 10 since ";F$(A) 1050 PRINT"was rated the most important.":PRINT 1060 PRINT" On this scale, what value of importance" 1070 PRINT"would the other factors have-" 1080 FOR J=1 TO NF:IF J=A THEN 1110 1090 PRINT:PRINT F$(J):INPUT V(J) 1100 IF V(J)<0 OR V(J)>10 THEN PRINT" Impossible value - Try again":GOTO 1090 1110 NEXT 1200 V(A)=10:Q=0:FOR J=1 TO NF:Q=Q+V(J):NEXT:FOR J=1 TO NF 1210 V(J)=V(J)/Q:NEXT:GOSUB 2000 1220 IF T<>3 THEN PRINT" Each ";T$; 1230 IF T=3 THEN PRINT" deciding 'YES' OR 'NO' "; 1240 PRINT" must now" 1250 PRINT"be compared with respect to each importance factor." 1260 PRINT" We'll consider each factor separately and then rate" 1270 IF T<>3 THEN PRINT"each ";T$;" IN TERMS" 1280 IF T=3 THEN PRINT"deciding 'YES' OR 'NO' in terms" 1290 PRINT"of that factor only.":PRINT 1300 PRINT" Let's give ";L$(1) 1310 PRINT"a value of 10 on every scale." 1320 IF T<>3 THEN PRINT" Then every other ";T$ 1330 IF T=3 THEN PRINT" Then deciding 'NO'" 1340 PRINT"will be assigned a value higher or lower than 10. This" 1350 PRINT"value depends on how much you think it is; better or worse" 1360 PRINT"than ";L$(1);".":PRINT:PRINT:PRINT 1370 PRINT" ********* (HIT ANY KEY TO CONTINUE) *********" 1380 R$=INKEY$:IF R$="" THEN 1380 1390 FOR J=1 TO NF 1400 PRINT TAB(8);STRING$(25,"-") 1410 PRINT" Considering "F$(J);" and" 1420 PRINT"assigning 10 to ";L$(1);" ;" 1430 PRINT"what value would you assign to" 1440 FOR K=2 TO NI 1450 PRINT L$(K);:INPUT C(K,J):IF C(K,J)>=0 THEN 1470 1460 PRINT" --NEGATIVE VALUES NOT LEGAL --":GOTO 1450 1470 NEXT:PRINT:C(1,J)=10:NEXT 1500 FOR J=1 TO NF:Q=0:FOR K=1 TO NI 1510 Q=Q+C(K,J):NEXT:FOR K=1 TO NI 1520 C(K,J)=C(K,J)/Q:NEXT:NEXT 1530 FOR K=1 TO NI:D(K)=0:FOR J=1 TO NF 1540 D(K)=D(K)+C(K,J)*V(J):NEXT:NEXT 1550 MX=0:FOR K=1 TO NI 1560 IF D(K)>MX THEN MX=D(K) 1570 NEXT:FOR K=1 TO NI:D(K)=D(K)*100/MX:NEXT 1600 FOR K=1 TO NI:Z(K)=K:NEXT:NM=NI-1 1610 FOR K=1 TO NI:FOR J=1 TO NM:N1=Z(J):N2=Z(J+1):IF D(NI)>D(N2) THEN 1630 1620 Z(J+1)=N1:Z(J)=N2 1630 NEXT:NEXT:J1=Z(1):J2=Z(2):DF=D(J1)-D(J2):GOSUB 2000 1700 PRINT L$(J1); 1710 PRINT" comes out best" 1720 IF DF<5 THEN PRINT"but it's very close.":GOTO 1800 1730 IF DF<10 THEN PRINT"but it's fairly close.":GOTO 1800 1740 IF DF<20 THEN PRINT"by a fair amount.":GOTO 1800 1750 PRINT"quite decisively." 1800 PRINT"- - - - HERE IS THE FINAL LIST IN ORDER - - - -" 1810 PRINT L$(J1);" has been" 1820 PRINT"given a value of 100 and the others rated accordingly." 1840 PRINT" ";STRING$(30,"-") 1850 FOR J=1 TO NI:Q=Z(J):PRINT D(Q),L$(Q):NEXT 1852 PRINT"PRESS RETURN TO CONTINUE" 1853 R$=INKEY$:IF R$="" THEN 1853 1855 RUN "DESK.BAS" 1860 END 2000 FOR J=1 TO 400:NEXT 2010 PRINT CL$:PRINT TAB(26);"DECIDE":PRINT:RETURN 2100 FOR J=1 TO 1500:NEXT:RETURN