home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / KAYPRO / NDSKMSTR.LBR / DECIDE.BQS / DECIDE.BAS
BASIC Source File  |  2000-06-30  |  6KB  |  150 lines

  1. 10 CLOSE
  2. 20 OPEN "I",1,"PARA.DAT"
  3. 30 INPUT #1, CLRSCRN
  4. 40 CLOSE #1
  5. 50 CL$=CHR$(CLRSCRN)
  6. 100 ' DECIDE
  7. 150 CLEAR 500
  8. 160 MD=10
  9. 170 DIM L$(MD),F$(MD),V(MD),C(MD,MD),D(MD),Z(MD)
  10. 180 E$="END"
  11. 200 GOSUB 2000
  12. 205 PRINT "          (Please depress CAPS LOCK key)" 
  13. 210 PRINT:PRINT"  I can help you make a decision. All I need to do is ask"
  14. 220 PRINT"some questions and then analyze the information you give."
  15. 230 PRINT:PRINT TAB(8);STRING$(44,"-"):PRINT
  16. 240 PRINT"Which of these best describes the type of decision facing you?"
  17. 250 PRINT:PRINT"  1) Choosing an item from various alternatives."
  18. 260 PRINT"  2) Choosing a course of action from various alternatives."
  19. 270 PRINT"  3) Making a 'YES' or 'NO' decision."
  20. 280 PRINT:PRINT"Which one (1,2, OR 3)?":
  21. 290 R$=INKEY$:IF R$="" THEN 290
  22. 300 T=VAL(R$): IF T<1 OR T>3 THEN 290
  23. 350 PRINT T:GOSUB 2000
  24. 400 FOR J=1 TO 9:R$=INKEY$:NEXT:ON T GOTO 410,440,470
  25. 410 PRINT"What type of item must you decide upon"
  26. 420 INPUT T$:GOTO 500
  27. 440 T$="Course of action":GOTO 500
  28. 470 T$="'YES' OR 'NO'"
  29. 480 NI=2:L$(1)="Deciding YES":L$(2)="Deciding NO"
  30. 490 GOTO 750
  31. 500 GOSUB 2000;NI=0
  32. 510 PRINT"  I need to have a list of each"
  33. 520 PRINT T$;" under consideration.":PRINT
  34. 530 PRINT"  Input them one at a time in response to each question mark."
  35. 540 PRINT"The order in which you input them has no special significance."
  36. 550 PRINT:PRINT"  Type the word '";E$;"' to indicate the whole list"
  37. 560 PRINT"has been entered.":PRINT
  38. 580 IF NI>=MD THEN PRINT"--LIST FULL--":GOTO 620
  39. 590 NI=NI+1:INPUT L$(NI)
  40. 600 IF L$(NI)<>E$ THEN 580
  41. 610 NI=NI-1
  42. 620 IF NI>=2 THEN 650
  43. 630 PRINT:PRINT"You must have at least 2 choices !":
  44. 640 PRINT"Try again":GOSUB 2100:GOTO 500
  45. 650 GOSUB 2000:PRINT"O.K. Here's the list you've given me:":PRINT
  46. 660 FOR J=1 TO NI:PRINT"  ";J;CHR$(24);") ";L$(J):NEXT:PRINT
  47. 670 FOR J=1 TO 9:R$=INKEY$:NEXT:PRINT"Is this list correct (Y OR N) ? ";
  48. 680 R$=INKEY$:IF R$="" THEN 680
  49. 690 IF R$="Y" THEN PRINT"YES":GOTO 750
  50. 700 IF R$="N" THEN PRINT"NO"
  51. 710 IF R$="N" THEN PRINT:PRINT"The list must be re-entered"
  52. 720 IF R$="N" THEN GOSUB 2100:GOSUB 500
  53. 730 GOTO 680
  54. 750 GOSUB 2000:FOR J=1 TO 9:R$=INKEY$:NEXT
  55. 760 PRINT"  Now, think of the different factors"
  56. 770 IF T<3 THEN PRINT"that are important to you in choosing"
  57. 780 IF T<3 THEN PRINT"the best ";T$;"."
  58. 790 IF T=3 THEN PRINT"that are important to you in deciding ";T$;"."
  59. 800 PRINT:PRINT"  Input them one at a time in response to each"
  60. 810 PRINT"question mark.":PRINT
  61. 820 PRINT"  Type the word '";E$;"' to terminate the list."
  62. 830 PRINT:NF=0
  63. 835 IF NF>=MD THEN PRINT"--LIST FULL--":PRINT:GOTO 870
  64. 840 NF=NF+1:INPUT F$(NF)
  65. 850 IF F$(NF)<>E$ THEN 835
  66. 860 NF=NF-1:PRINT
  67. 870 IF NF<1 THEN PRINT"You must have at least one! --Redo it"
  68. 880 IF NF<1 THEN GOSUB 2100:GOTO 750
  69. 890 GOSUB 2000:PRINT"Here's the list of factors you gave me:':?
  70. 900 FOR J=1 TO NF:PRINT"  ";J;CHR$(24);") ";F$(J):NEXT:PRINT
  71. 910 PRINT"  Decide which factor on the list is the most important"
  72. 920 PRINT"and input it's number.  (Type '0' if the list needs changing.)"
  73. 930 PRINT
  74. 940 INPUT A:A=INT(A):IF A=0 THEN 750
  75. 950 IF A>NF OR A<0 THEN 890
  76. 1000 GOSUB 2000:IF NF=1 THEN 1200
  77. 1010 PRINT"  Now let's suppose we have a scale of importance"
  78. 1020 PRINT"ranging from 0-10."
  79. 1030 PRINT:PRINT"  We'll give ";F$(A);" a"
  80. 1040 PRINT"value of 10 since ";F$(A)
  81. 1050 PRINT"was rated the most important.":PRINT
  82. 1060 PRINT"  On this scale, what value of importance"
  83. 1070 PRINT"would the other factors have-"
  84. 1080 FOR J=1 TO NF:IF J=A THEN 1110
  85. 1090 PRINT:PRINT F$(J):INPUT V(J)
  86. 1100 IF V(J)<0 OR V(J)>10 THEN PRINT"  Impossible value - Try again":GOTO 1090
  87. 1110 NEXT
  88. 1200 V(A)=10:Q=0:FOR J=1 TO NF:Q=Q+V(J):NEXT:FOR J=1 TO NF
  89. 1210 V(J)=V(J)/Q:NEXT:GOSUB 2000
  90. 1220 IF T<>3 THEN PRINT"   Each ";T$;
  91. 1230 IF T=3 THEN PRINT"   deciding 'YES' OR 'NO' ";
  92. 1240 PRINT" must now"
  93. 1250 PRINT"be compared with respect to each importance factor."
  94. 1260 PRINT"   We'll consider each factor separately and then rate"
  95. 1270 IF T<>3 THEN PRINT"each ";T$;" IN TERMS"
  96. 1280 IF T=3 THEN PRINT"deciding 'YES' OR 'NO' in terms"
  97. 1290 PRINT"of that factor only.":PRINT
  98. 1300 PRINT"   Let's give ";L$(1)
  99. 1310 PRINT"a value of 10 on every scale."
  100. 1320 IF T<>3 THEN PRINT"   Then every other ";T$
  101. 1330 IF T=3 THEN PRINT"   Then deciding 'NO'"
  102. 1340 PRINT"will be assigned a value higher or lower than 10. This"
  103. 1350 PRINT"value depends on how much you think it is; better or worse"
  104. 1360 PRINT"than ";L$(1);".":PRINT:PRINT:PRINT
  105. 1370 PRINT" ********* (HIT ANY KEY TO CONTINUE) *********"
  106. 1380 R$=INKEY$:IF R$="" THEN 1380
  107. 1390 FOR J=1 TO NF
  108. 1400 PRINT TAB(8);STRING$(25,"-")
  109. 1410 PRINT"  Considering "F$(J);" and"
  110. 1420 PRINT"assigning 10 to ";L$(1);" ;"
  111. 1430 PRINT"what value would you assign to"
  112. 1440 FOR K=2 TO NI
  113. 1450 PRINT L$(K);:INPUT C(K,J):IF C(K,J)>=0 THEN 1470
  114. 1460 PRINT"  --NEGATIVE VALUES NOT LEGAL --":GOTO 1450
  115. 1470 NEXT:PRINT:C(1,J)=10:NEXT
  116. 1500 FOR J=1 TO NF:Q=0:FOR K=1 TO NI
  117. 1510 Q=Q+C(K,J):NEXT:FOR K=1 TO NI
  118. 1520 C(K,J)=C(K,J)/Q:NEXT:NEXT
  119. 1530 FOR K=1 TO NI:D(K)=0:FOR J=1 TO NF
  120. 1540 D(K)=D(K)+C(K,J)*V(J):NEXT:NEXT
  121. 1550 MX=0:FOR K=1 TO NI
  122. 1560 IF D(K)>MX THEN MX=D(K)
  123. 1570 NEXT:FOR K=1 TO NI:D(K)=D(K)*100/MX:NEXT
  124. 1600 FOR K=1 TO NI:Z(K)=K:NEXT:NM=NI-1
  125. 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
  126. 1620 Z(J+1)=N1:Z(J)=N2
  127. 1630 NEXT:NEXT:J1=Z(1):J2=Z(2):DF=D(J1)-D(J2):GOSUB 2000
  128. 1700 PRINT L$(J1);
  129. 1710 PRINT" comes out best"
  130. 1720 IF DF<5 THEN PRINT"but it's very close.":GOTO 1800
  131. 1730 IF DF<10 THEN PRINT"but it's fairly close.":GOTO 1800
  132. 1740 IF DF<20 THEN PRINT"by a fair amount.":GOTO 1800
  133. 1750 PRINT"quite decisively."
  134. 1800 PRINT"- - - - HERE IS THE FINAL LIST IN ORDER - - - -"
  135. 1810 PRINT L$(J1);" has been"
  136. 1820 PRINT"given a value of 100 and the others rated accordingly."
  137. 1840 PRINT"   ";STRING$(30,"-")
  138. 1850 FOR J=1 TO NI:Q=Z(J):PRINT D(Q),L$(Q):NEXT
  139. 1852 PRINT"PRESS RETURN TO CONTINUE"
  140. 1853 R$=INKEY$:IF R$="" THEN 1853
  141. 1855 RUN "DESK.BAS"
  142. 1860 END
  143. 2000 FOR J=1 TO 400:NEXT
  144. 2010 PRINT CL$:PRINT TAB(26);"DECIDE":PRINT:RETURN
  145. 2100 FOR J=1 TO 1500:NEXT:RETURN
  146. AS"
  147. 1860 END
  148. 2000 FOR J=1 TO 400:NEXT
  149. 2010 PRINT CL$:PRINT TAB(26);"DECIDE":PRINT:RETURN
  150. 2100 FOR J=1 TO 15