0 'DECIDE.BA - BY PHIL WHEELER 1 'CLUB 100 LIBRARY - 415/939-1246 BBS, 937-5039 NEWSLETTER, 932-8856 VOICE 2 'adapted from an MBASIC version found 3 'on an RCP/M. It can be a game or a 4 'tool. It is not compact (the Byte 5 'Fyter could make mincemeat of this; 6 'but I'd rather he worked on MVCWM -- 7 'a truly worthwhile program). Remove 8 'editorial after downloading. 9 ' Phil Wheeler 10 CLEAR500:DIMF$(10),L$(10),F(10),M(10,10),V(10),Z(10),Z$(1):RV$=CHR$(27)+"p":NO$=CHR$(27)+"q":PRINTRV$+" DECISION "+NO$:PRINT"Which best describes the type of":PRINT"decision you have to make:":PRINT"(1) Choose an item" 11 PRINT"(2) Choose a course of action" 12 INPUT"Which type (1 or 2)";C:IFC<1ORC>2THENPRINT"ILLEGAL CHOICE.":GOTO12 13 PRINT:IFC=1THENPRINT"What type of item is it that you" 14 IFC=1THENINPUT"need to decide upon";S$ 15 IFC=2THENS$="Action" 16 PRINT:PRINT"Now list each ";S$:PRINT"being considered,one at a time.":PRINT"The order is not important." 17 PRINT:INPUT" First, how many are there ";L0:IFL0>=2ANDL0<=10THEN19 18 GOSUB39:GOTO17 19 PRINT:FORI=1TOL0:PRINT"Number";I;"please";:INPUTL$(I):NEXTI:PRINT:FORI=1TOL0:PRINTI;TAB(5);L$(I):NEXTI:PRINT:GOSUB40:IFLEFT$(B$,1)<>"Y"ANDLEFT$(B$,1)<>"y"THEN16 20 PRINT:PRINT"How many factors are important":PRINT"in choosing a ";S$;:INPUTF0:IFF0>=1ANDF0<=10THEN22 21 GOSUB39:GOTO20 22 PRINT:PRINT"I need a list of each of these factors.":FORI=1TOF0:PRINT"Factor number";I;:INPUTF$(I):NEXTI:GOSUB43:PRINT"Now decide which is the most important:":FORI=1TOF0:PRINTI;TAB(5);F$(I):NEXTI 23 PRINT"Which factor (by no.) is most important?":INPUT"(Input 0 to change the list)";F2:PRINT:IFF2=0THEN20 24 IFF2<1ORF2>F0THEN23 25 PRINT"Suppose a scale of importance":PRINT"from 0 to 10. Say ";F$(F2);" has a value":PRINT"of 10 since it is at the top.":PRINT"What value would each of the others":PRINT"have (decimal numbers are O.K.)?":FORI=1TOF0:IFI=F2THEN28 26 PRINTF$(I);:INPUTF(I):IFF(I)>=0ANDF(I)<=10THEN28 27 PRINT" Your input is no good, try again.":GOTO26 28 NEXTI:F(F2)=10:C=0:FORI=1TOF0:C=C+F(I):NEXTI:FORI=1TOF0:F(I)=F(I)/C:NEXTI:PRINT:PRINT"Now consider how each ";S$:PRINT"rates for each of the factors.":PRINT"Consider each factor alone & rate each":PRINTS$;" in terms of that factor only.":GOSUB43 29 PRINT"Let's consider ";L$(1);" to have a":PRINT"value of 10 on each scale.":PRINT"Then every other ";S$;" will be given":PRINT"a number higher or lower than 10":PRINT"according to how much better or worse" 30 PRINT"than ";L$(1);" you think it is.":GOSUB43:FORI=1TOF0:PRINT:PRINT"Considering ";F$(I);" only, and":PRINT"assuming ";L$(1);" to be 10,":PRINT"what value would you give":PRINT"to each of the following:":M(1,I)=10:PRINT:FORJ=2TOL0 31 PRINTL$(J);:INPUTM(J,I):IFM(J,I)>=0THEN33 32 PRINT"No negative numbers. Try again.":GOTO31 33 C=C+M(J,I):NEXTJ:FORJ=1TOL0:M(J,I)=M(J,I)/C:NEXTJ:NEXTI:FORJ=1TOL0:V(J)=0:FORI=1TOF0:V(J)=V(J)+M(J,I)*F(I):NEXTI:NEXTJ:FORI=1TO10:Z(I)=I:NEXTI:C=L0-1:FORJ=1TOL0:FORI=1TOC:N1=Z(I):N2=Z(I+1):IFV(N1)>V(N2)THEN35 34 Z(I+1)=N1:Z(I)=N2 35 NEXTI:NEXTJ:C1=Z(1):C2=Z(2):C=100/V(C1):FORJ=1TOL0:V(J)=C*V(J):NEXTJ:PRINT:PRINT:D=V(C1)-V(C2):PRINT"Your best choice is ";L$(C1):IFD<10THENPRINT"but it's pretty close." 36 IFD<20ANDD>=10THENPRINT"by a fair margin." 37 IFD>=20THENPRINT"by a good-sized margin." 38 GOSUB43:PRINT"Here's the final list with ";L$(C1):PRINT"given a value of 100":PRINT"and the others set accordingly.":GOSUB43:PRINTS$,"Rating":FORJ=1TOL0:C=Z(J):PRINTL$(C),V(C):NEXTJ:GOTO41 39 PRINT"The number must be between 2 and 10.":RETURN 40 INPUT"Is this correct";B$:RETURN 41 INPUT"Do you have another case";A$:IFLEFT$(A$,1)<>"N"ANDLEFT$(A$,1)<>"n"THENRUN 42 MENU 43 PRINTRV$+">>Press any key to continue<<"+NO$:Z$=INPUT$(1):RETURN