home *** CD-ROM | disk | FTP | other *** search
/ Nibble Magazine / nib37b.dsk / WIDGETS.bas < prev    next >
BASIC Source File  |  2023-02-26  |  27KB  |  342 lines

  1. 10  REM ***************************
  2. 20  REM *        WIDGETS          *
  3. 30  REM *  BY ALEXANDER LAIRD     *
  4. 40  REM *  COPYRIGHT (C) 1989     *
  5. 50  REM *  MINDCRAFT PUBL. Corp.  *
  6. 60  REM *  CONCORD, MA 01742      *
  7. 70  REM ***************************
  8. 80  GOTO 2630
  9. 90 : REM  CLEAR FLASH AREA
  10. 100  VTAB 11: FOR F = 1 TO 7: HTAB 30: CALL  -868: PRINT : NEXT : RETURN 
  11. 110 :
  12. 120 : REM [ INTEGER ALIGN ]
  13. 130 AL$ =  STR$(AL):AA =  LEN(AL$): RETURN 
  14. 140 :
  15. 150 : REM [ DECIMAL ALIGN ]
  16. 160 AL =  INT(AL *100 +.5)/100
  17. 170  IF AL = 0  THEN AL$ = "0.00":AA = 4: RETURN 
  18. 180 AX =  INT(AL *100):AX$ =  STR$(AX)
  19. 190  IF  LEN(AX$) <3  THEN AX$ = "0" +AX$: GOTO 190
  20. 200 LF$ =  LEFT$(AX$, LEN(AX$) -2):RT$ =  RIGHT$(AX$,2):AL$ = LF$ +"." +RT$
  21. 210 AA =  LEN(AL$): RETURN 
  22. 220 :
  23. 230 :
  24. 240 : REM  [ DISPLAY RESULTS ]
  25. 250  VTAB 12: FOR F = 1 TO 5: HTAB 30: CALL  -868: PRINT : NEXT 
  26. 260  VTAB 1: CALL  -868: PRINT "[[ OPERATING PERFORMANCE ]]"
  27. 270  CALL  -868: PRINT "Entering quarter ";QTR;" your workforce is ";EMPL;".";: POKE 36,50: PRINT "Revenue.........";:AL =  INT(REV): GOSUB 130: POKE 36,74 -AA: PRINT AL$
  28. 280  CALL  -868: PRINT NEMP;" employees joined the company.";: POKE 36,50: PRINT "-Mfg cost.......";:AL =  INT(MCST): GOSUB 130: POKE 36,74 -AA: PRINT AL$
  29. 290  CALL  -868: PRINT LEMP;" employees left the company.";: POKE 36,50: PRINT "-Payroll........";:AL =  INT(DE(1)): GOSUB 130: POKE 36,74 -AA: PRINT AL$
  30. 300  CALL  -868: PRINT "You manufactured ";DE(4);"(000) Widgets.";: POKE 36,50: PRINT "-Advertising....";:AL =  INT(DE(3)): GOSUB 130: POKE 36,74 -AA: PRINT AL$
  31. 310  CALL  -868:UCST =  INT(UCST *100 +.5)/100: PRINT "Standard unit cost was $";UCST;"/unit.";: POKE 36,50: PRINT "-Research.......";:AL =  INT(RCST): GOSUB 130: POKE 36,74 -AA: PRINT AL$
  32. 320  CALL  -868:IVTY =  INT(IVTY): PRINT "Current inventory is: ";IVTY;"(000) units.";: POKE 36,50: PRINT "*Net Profit.....";:AL =  INT(PFT): GOSUB 130: POKE 36,74 -AA: PRINT AL$
  33. 330  CALL  -868: PRINT "You sold ";PSALE;"(000) units at $";DE(2);"/unit.";: POKE 36,50: PRINT "*Available Cash.";:AL =  INT(CASH): GOSUB 130: POKE 36,74 -AA: PRINT AL$
  34. 340  CALL  -868
  35. 350  REM  COMPARATIVE RESULTS
  36. 360 P(1) = (EMPL/XEMP) -1:P(2) = (IVTY/XIVTY) -1:P(3) = (PSALE/XPSALE) -1:P(4) = (UCST/XUCST) -1:P(5) = (SAL/XSAL) -1: REM PERCENT CHANGE
  37. 370  FOR F = 1 TO 5:P$(F) = "up": IF P(F) <0  THEN P$(F) = "down"
  38. 380 P(F) =  ABS(P(F) *100):AL = P(F): GOSUB 160:PC$(F) = AL$
  39. 390  NEXT 
  40. 400  VTAB 11: HTAB 33: PRINT "[[ COMPARATIVE RESULTS ]]": HTAB 30: PRINT "Workforce went ";P$(1);" by ";: POKE 36,70 - LEN(PC$(1)): PRINT PC$(1);"%"
  41. 410  HTAB 30: PRINT "Inventory went ";P$(2);" by ";: POKE 36,70 - LEN(PC$(2)): PRINT PC$(2);"%"
  42. 420  IF QTR >2  THEN  HTAB 30: PRINT "Product sales went ";P$(3);" by ";: POKE 36,70 - LEN(PC$(3)): PRINT PC$(3);"%"
  43. 430  HTAB 30: PRINT "Unit cost went ";P$(4);" by ";: POKE 36,70 - LEN(PC$(4)): PRINT PC$(4);"%"
  44. 440  HTAB 30: PRINT "Salary cost went ";P$(5);" by ";: POKE 36,70 - LEN(PC$(5)): PRINT PC$(5);"%"
  45. 450  RETURN 
  46. 460 :
  47. 470 :
  48. 480 : REM [ OPERATING RESULTS ]
  49. 490 QTR = QTR +1
  50. 500 XEMP = EMPL:XIVTY = IVTY:XUCST = UCST:XPSALE = PSALE:XSAL = SAL
  51. 510  IF XPSALE = 0  THEN XPSALE = 1
  52. 520  IF XIVTY = 0  THEN XIVTY = 1
  53. 530  IF DE(5) <RD(2)  THEN UCST = UCST *1.3
  54. 540  IF DE(5) > = RD(2)  AND DE(5) <RD(3)  THEN UCST = UCST *1.15
  55. 550  IF DE(5) > = RD(4)  AND DE(5) <RD(5)  THEN UCST = UCST *.85
  56. 560  IF DE(5) > = RD(5)  THEN UCST = UCST *.70
  57. 570  IF FL(1) >0  THEN DE(4) =  INT(DE(4)/2):MCST = MCST +FL(1): REM  FLASH 1...ADD FIRE COST TO MFG COST (MCST)
  58. 580  IF FL(4) >0  THEN UCST = UCST -1: REM  FLASH 4...REDUCE UNIT COST
  59. 590  IF FL(6) >0  THEN MCST = MCST +(DE(4) *FL(6)): REM  FLASH 6...ADDED REWORK COST * PRODUCTION
  60. 600  IF UCST <9  THEN UCST = 9
  61. 610 IVTY = IVTY +DE(4):MCST = MCST +(DE(4) *UCST): REM MFG->INVENTORY AND MFG COST
  62. 620  IF FL(7) >0  THEN NEMP = FL(7): REM  FLASH 7...ADDT'L EMPLOYEES
  63. 630  IF FL(8) >0  THEN LEMP = FL(8): REM  FLASH 8...LOST EMPLOYEES
  64. 640 RCST = DE(5) +RP: REM  ADD MKT REPORT TO R&D COST
  65. 650 HIT = 0: IF DE(2) <PC(2)  THEN HIT = 1: GOTO 690
  66. 660  IF DE(2) > = PC(7)  THEN HIT = 7: GOTO 690
  67. 670  FOR F = 2 TO 6: IF DE(2) > = PC(F)  AND DE(2) <PC(F +1)  THEN HIT = F:F = 6
  68. 680  NEXT 
  69. 690 PE = PI(HIT): REM  PRICE EFFECT%
  70. 700 HIT = 0: IF DE(3) <AI(2)  THEN HIT = 1: GOTO 740
  71. 710  IF DE(3) > = AI(8)  THEN HIT = 8: GOTO 740
  72. 720  FOR F = 2 TO 7: IF DE(3) > = AD(F)  AND DE(3) <AD(F +1)  THEN HIT = F:F = 7
  73. 730  NEXT 
  74. 740 AE = AI(HIT): REM  ADVTSG EFFECT%
  75. 750 SL = ((PE/100) *(PAD/100)) +((AE/100) *(APR/100)): REM  SALES % OF INVENTORY
  76. 760  IF FL(3) >0  THEN SL = 1.00:DE(2) = FL(3): REM  FLASH 3... SELL 100% OF INVTY
  77. 770  IF SL >1  THEN SL = 1
  78. 780 PSALE = IVTY *SL: REM  BASIC SALES VOLUME
  79. 790  IF FL(2) >0  THEN PSALE = PSALE *((100 -FL(2))/100): REM  FLASH 2... REDUCED SALES TRANSPORTATION SHUTDOWN
  80. 800  IF FL(9) >0  THEN PSALE = PSALE + INT(PSALE *(FL(9)/100)): REM  FLASH 9... ADDED SALES
  81. 810  IF PSALE >IVTY  THEN PSALE = IVTY
  82. 820  IF FL(5) >0  THEN SAL = SAL *1.25:PRDN = PRDN +1: REM FLASH 5...BENEFITS PLAN EFFECT
  83. 830 REV = PSALE *DE(2):IVTY = IVTY -PSALE: IF SFLAG = 1  THEN SFLAG = 0:REV = IVTY *29.95:DE(2) = 29.95:PSALE = IVTY:IVTY = 0: REM  REVENUE CALCULATION
  84. 840  IF SFLAG = 1  THEN SFLAG = 0:REV = IVTY *29.95:IVTY = 0
  85. 850  IF FL(10) >0  THEN SFLAG = 1: REM  FLASH 10...SELL OUT FLAG NEXT PERIOD
  86. 860 MPAY = EMPL *SAL: REM  MIN PAYROLL
  87. 870  IF DE(1) > = MPAY  THEN NEMP = NEMP + INT((DE(1) -MPAY)/10) + INT( RND(1) *10): REM ADDED EMPLOYEES
  88. 880  IF DE(1) <MPAY  THEN LEMP = LEMP + INT((MPAY -DE(1))/SAL) + INT( RND(1) *4): REM LOST EMPLOYEES
  89. 890  IF LEMP >(EMPL +NEMP)  THEN LEMP = EMPL +NEMP: REM  AVOID NEGATIVE EMPLOYEES
  90. 900 EMPL = EMPL +NEMP -LEMP
  91. 910 FLTN = ( RND(1) *3) +1: REM  INFLATION 1-3%
  92. 920 UCST = UCST +(UCST *(FLTN/100)):SAL = SAL +(SAL *(FLTN/100)): REM  INFLATION EFFECT
  93. 930 HPFT =  INT( RND(1) *250) +500: REM  EXCESS PROFIT
  94. 940 PFT = REV -DE(1) -MCST -DE(3) -RCST: REM PROFIT = REV - PAYROLL - MFG - ADVTSG - R&D
  95. 950 PFT =  INT(PFT)
  96. 960  IF PFT >HPFT  THEN  VTAB 12: HTAB 30: CALL  -868: PRINT "STRIKE! Excess profits of $";PFT;" cause": HTAB 30: CALL  -868: PRINT "employee and supplier complaints."
  97. 970  IF PFT >HPFT  THEN  HTAB 30: CALL  -868: PRINT "Employee costs rise by $1.00 per unit"
  98. 980  IF PFT >HPFT  THEN  HTAB 30: CALL  -868: PRINT "and profits are reduced by 50%":PFT =  INT(PFT/2):SAL = SAL +1: VTAB 18: HTAB 30: INVERSE : PRINT "<RETURN> TO CONTINUE:";: NORMAL : GET XX$: VTAB 18: POKE 1403,29: CALL  -868
  99. 990 CASH = CASH +PFT
  100. 1000 CASH =  INT(CASH):UCST =  INT(UCST *100 +.5)/100:FLTN =  INT(FLTN *100 +.5)/100:SAL =  INT(SAL *100 +.5)/100:PFT =  INT(PFT):MCST =  INT(MCST):IVTY =  INT(IVTY):PSALE =  INT(PSALE)
  101. 1010  IF CASH < = 0  THEN  GOSUB 100: VTAB 12: HTAB 30: PRINT "OUT OF CASH! You must": HTAB 30: PRINT "sell 50% of production": HTAB 30: PRINT "capacity to replenish cash ($1000).": HTAB 30
  102. 1020  IF CASH < = 0  THEN  HTAB 30: PRINT "<RETURN> to sell:";: GET XX$:CASH = CASH +1000:PRDN = PRDN/2:PRDN =  INT(PRDN *100 +.5)/100: IF CASH <0  THEN 1010: REM STILL NEGATIVE
  103. 1030  IF EMPL < = 0  THEN  GOSUB 100: VTAB 12: HTAB 30: PRINT "You've lost all your people. You must ": POKE 1403,29: PRINT "spend 50% of your cash balance of $";CASH
  104. 1040  IF EMPL = 0  THEN  HTAB 30: PRINT "to hire new people at 30% premium."
  105. 1050  IF EMPL = 0  THEN  HTAB 30: PRINT "<RETURN> to hire new people.";: GET XX$:CASH =  INT(CASH/2):EMPL =  INT(CASH/(SAL *1.30)):DE(1) = DE(1) +CASH:NEMP = NEMP +EMPL
  106. 1060  IF PRDN <.5  THEN  GOSUB 100: VTAB 12: HTAB 30: PRINT "You've gone into negative cash": HTAB 30: PRINT "for the last time. You're bankrupt!": HTAB 30: PRINT "<RETURN> for Directors Report.";: GET XX$:BK = 1
  107. 1070  RETURN 
  108. 1080 :
  109. 1090 :
  110. 1100 : REM [ FLASH REPORTS ]
  111. 1110  FOR F = 1 TO 10:F$(F) = "":FL(F) = 0: NEXT 
  112. 1120 FA =  INT( RND(1) *20) +1: REM  1-20
  113. 1130  IF FA >10  THEN F$(1) = "FLASH Report: Industry is stable for":F$(2) = "the current period.": GOTO 1240
  114. 1140  IF FA = 1  THEN FL(1) =  INT( RND(1) *100) +125:F$(1) = "FLASH Report: FIRE in the plant. The":F$(2) = "production is cut by 50% while repairs":F$(3) = "are made.  The cost to restore your":F$(4) = "production is: " + STR$(FL(1)): GOTO 1240
  115. 1150  IF FA = 2  THEN FL(2) =  INT( RND(1) *20) +10:F$(1) = "FLASH Report: Transportation shutdown!":F$(2) =  STR$(FL(2)) +"% of sales cannot be shipped.  Your":F$(3) = "customers cancel orders!": GOTO 1240
  116. 1160  IF FA = 3  THEN FL(3) =  INT( RND(1) *15) +20:F$(1) = "FLASH Report: Major government order!":F$(2) = "Entire inventory sells out at $" + STR$(FL(3)): GOTO 1240
  117. 1170  IF FA = 4  THEN FL(4) = 1:F$(1) = "FLASH Report: Outstanding parts buy!":F$(2) = "Manufacturing cost drops by $1.00!": GOTO 1240
  118. 1180  IF FA = 5  THEN FL(5) = 1:F$(1) = "FLASH Report: New Benefits Plan is":F$(2) = "introduced.  Cost per employee goes":F$(3) = "up by 25% but productivity rises by":F$(4) = "1(000) units per person.": GOTO 1240
  119. 1190  IF FA = 6  THEN FL(6) = (( RND(1) *150) +100)/100:AL = FL(6): GOSUB 160:F$(1) = "FLASH Report: Quality defects require":F$(2) = "rework with added cost of $" +AL$:FL(6) =  VAL(AL$):F$(3) = "per unit.": GOTO 1240
  120. 1200  IF FA = 7  THEN FL(7) =  INT( RND(1) *15) +10:F$(1) = "FLASH Report: Layoff in neighboring":F$(2) = "plant. " + STR$(FL(7)) +" more employees are hired":F$(3) = "and ready to produce next quarter.": GOTO 1240
  121. 1210  IF FA = 8  THEN FL(8) =  INT( RND(1) *11) +5:F$(1) = "FLASH Report: Competitor raids your":F$(2) = "company and " + STR$(FL(8)) +" employees resign.": GOTO 1240
  122. 1220  IF FA = 9  THEN FL(9) =  INT( RND(1) *11) +20:F$(1) = "FLASH Report: Widgets wins advertising":F$(2) = "award!  Market demand rises by " + STR$(FL(9)) +"%.": GOTO 1240
  123. 1230  IF FA = 10  THEN FL(10) = 1:F$(1) = "FLASH Report: Major order received!":F$(2) = "Total inventory can be sold at $29.95":F$(3) = "next period with no advertising expense.": GOTO 1240
  124. 1240  VTAB 12: FOR F = 1 TO 5: HTAB 30: PRINT F$(F): NEXT 
  125. 1250  VTAB 18: HTAB 30: INVERSE : PRINT "<RETURN> TO CONTINUE:";: NORMAL : GET XX$: VTAB 18: POKE 1403,0: CALL  -868: VTAB 1: POKE 1403,0
  126. 1260  RETURN 
  127. 1270 :
  128. 1280 :
  129. 1290 : REM [ CALCULATE BUSINESS INDEXES ]
  130. 1300 :
  131. 1310 : REM [PRICE SENSITIVITY]
  132. 1320 X = 100: FOR F = 1 TO 6:PI(F) = X: IF F <3  THEN X = X -15
  133. 1330  IF F > = 3  THEN X = X -10
  134. 1340  NEXT 
  135. 1350 TEMP =  INT( RND(1) *7) +1:TEMP = TEMP +5: REM RANGE 5-12
  136. 1360 PC(1) = 9.95:PC(7) = 29.95:PC(4) = TEMP +9.95:
  137. 1370 PC(6) = 29.95 -((PC(7) -PC(4))/2)
  138. 1380 PC(2) = 9.95 +((PC(4) -PC(1))/2)
  139. 1390 PC(3) = PC(2) +((PC(4) -PC(2))/2)
  140. 1400 PC(5) = PC(4) +((PC(6) -PC(4))/2)
  141. 1410 TEMP =  INT( RND(1) *5) +2: REM  RANDOM LINE # 2-6 FOR MARKET WINDOW
  142. 1420 PI(TEMP) = 50 + INT( RND(1) *50)
  143. 1430 :
  144. 1440 : REM  ADVTSG INDEX
  145. 1450 X = 10: FOR F = 2 TO 8:AI(F) = X: IF F <5  THEN X = X +20
  146. 1460  IF F >4  THEN X = X +10
  147. 1470  NEXT 
  148. 1480 TEMP =  INT( RND(1) *50) +75: REM  RANGE 75-124
  149. 1490 AD(4) = TEMP
  150. 1500 AD(1) = 25:AD(8) = 200
  151. 1510 AD(2) = 25 + INT((AD(4) -AD(1))/2)
  152. 1520 AD(3) =  INT((AD(4) -AD(2))/2) +AD(2)
  153. 1530 AD(6) =  INT((AD(8) -AD(4))/2) +AD(4)
  154. 1540 AD(5) =  INT((AD(6) -AD(4))/2) +AD(4)
  155. 1550 AD(7) =  INT((AD(8) -AD(6))/2) +AD(6)
  156. 1560 TEMP =  INT( RND(1) *6) +2: REM  RANDOM LINE # 2-7 FOR MARKET WINDOW
  157. 1570 AI(TEMP) = 50 + INT( RND(1) *50)
  158. 1580 :
  159. 1590 : REM  [R&D INDEX]
  160. 1600 AMT = 30
  161. 1610  FOR F = 1 TO 5
  162. 1620 TEMP = (F *25) +25
  163. 1630 RD(F) = TEMP +RN
  164. 1640 RN =  INT( RND(1) *25) +1:RD(F) = RD(F) +RN
  165. 1650 RI(F) = AMT:AMT = AMT -15
  166. 1660  NEXT F
  167. 1670 :
  168. 1680 : REM [PRICE/AD IMPACT]
  169. 1690 PAD =  INT( RND(1) *30) +40:APR = 100 -PAD
  170. 1700  RETURN 
  171. 1710 :
  172. 1720 :
  173. 1730 : REM [MARKET REPORT]
  174. 1740 RP = 0
  175. 1750  VTAB 17: CALL  -868
  176. 1760  VTAB 18: CALL  -868: IF (MKT *1.25) >CASH +20  THEN  PRINT "You don't have enough cash to buy the Market Report. <RETURN> to continue:";: GET XX$:MKT$ = "N": GOTO 1780
  177. 1770  POKE 1403,0: VTAB 18: CALL  -868: PRINT "Do you wish to purchase the Market Report for $";MKT;: PRINT "K?  Y/N:";: GET MKT$: PRINT MK$;: IF MKT$ < >"Y"  AND MKT$ < >"N"  AND MKT$ < >"y"  AND MKT$ < >"n"  THEN 1770
  178. 1780  VTAB 18: POKE 1403,0: CALL  -868
  179. 1790  IF MKT$ = "Y"  OR MKT$ = "y"  THEN RP = MKT
  180. 1800 MKT = MKT *1.25:MKT =  INT(MKT)
  181. 1810  IF MKT$ < >"Y"  AND MKT$ < >"y"  THEN  RETURN 
  182. 1820  POKE 1403,0: VTAB 10: CALL  -868: IF MKT$ < >"Y"  AND MKT$ < >"y"  THEN  RETURN 
  183. 1830  VTAB 1: POKE 1403,0: PRINT "R&D Index..........Price Index..........Advertising Index"
  184. 1840  FOR F = 1 TO 8
  185. 1850  POKE 1403,0: CALL  -868
  186. 1860  IF F < = 5  THEN AL = RD(F): GOSUB 130: POKE 36,3 -AA: PRINT AL$;:AL = RI(F): GOSUB 130: POKE 36,8 -AA: PRINT AL$;"%";
  187. 1870  IF F = 7  THEN  PRINT "Price/Ad Mix";
  188. 1880  IF F = 8  THEN AL = PAD: GOSUB 130: POKE 36,3 -AA: PRINT AL$;"%";:AL = APR: GOSUB 130: POKE 36,9 -AA: PRINT AL$;"%";
  189. 1890  IF F < = 7  THEN AL = PC(F): GOSUB 160: POKE 36,24 -AA: PRINT AL$;:AL = PI(F): GOSUB 130:: POKE 36,29 -AA: PRINT AL$;"%";
  190. 1900 AL = AD(F): GOSUB 130: POKE 36,47 -AA: PRINT AL$;:AL = AI(F): GOSUB 130: POKE 36,51 -AA: PRINT AL$;"%"
  191. 1910  NEXT F
  192. 1920  VTAB 17: PRINT "Market Report..:";: HTAB 18: PRINT RP
  193. 1930  VTAB 18: CALL  -868: INVERSE : PRINT "PRINT MARKET REPORT? Y/N:";: NORMAL : GET XX$: POKE 1403,0: VTAB 18: CALL  -868: IF XX$ < >"Y"  AND XX$ < >"N"  AND XX$ < >"y"  AND XX$ < >"n"  THEN 1930
  194. 1940  IF XX$ = "Y"  OR XX$ = "y"  THEN  CALL 768
  195. 1950  VTAB 18: CALL  -868
  196. 1960  RETURN 
  197. 1970 :
  198. 1980 :
  199. 1990 : REM  [ ENTER DECISIONS ]
  200. 2000  VTAB 10: POKE 1403,0: FOR F = 1 TO 76: PRINT "=";: NEXT : PRINT 
  201. 2010  VTAB 11: POKE 1403,2: PRINT "[[ DECISIONS ]]"
  202. 2020  GOSUB 100
  203. 2030  POKE 1403,0: VTAB 12: PRINT "Payroll........: ": PRINT "Price..........: ": PRINT "Advertising....: ": PRINT "Production(k)..: ": PRINT "Research & Dev.: ":
  204. 2040  VTAB 12: FOR F = 1 TO 5: HTAB 18: CALL  -868: PRINT DE(F): NEXT 
  205. 2050  VTAB 12: FOR F = 1 TO 5: HTAB 18: INPUT "";X$
  206. 2060  IF X$ < >""  THEN DE(F) =  VAL(X$)
  207. 2070  VTAB 12 +(F -1): HTAB 18: CALL  -868: PRINT DE(F)
  208. 2080  NEXT 
  209. 2090  IF DE(4) >(EMPL *PRDN)  THEN  VTAB 18: PRINT "You don't have enough employees to produce: ";DE(4);: PRINT ".  Press RETURN:";: GET XX$: POKE 1403,0: VTAB 18: CALL  -868: GOTO 2030
  210. 2100 HIT = 0: FOR F = 1 TO 5: IF DE(F) <0  THEN HIT = F
  211. 2110  NEXT 
  212. 2120  IF HIT >0  THEN  VTAB 18: PRINT "You cannot enter a negative number for decisions.  Press RETURN:";: GET XX$: POKE 1403,0: VTAB 18: CALL  -868: GOTO 2030
  213. 2130  IF DE(1) = 0  OR DE(2) = 0  OR DE(4) = 0  THEN  VTAB 18: PRINT "You must use a positive number for Payroll, Price & Prod'n.  Press RETURN:";: GET XX$: POKE 1403,0: VTAB 18: CALL  -868: GOTO 2030
  214. 2140  IF (DE(1) +DE(3) +DE(5) +RP) >CASH  THEN  VTAB 18: PRINT "You don't have enough cash to pay for these decisions.  Press RETURN:";: GET XX$: POKE 1403,0: VTAB 18: CALL  -868: GOTO 2030
  215. 2150  POKE 1403,0: VTAB 18: INVERSE : PRINT "<RETURN> TO ACCEPT... R TO REENTER:";: NORMAL : GET XX$: IF XX$ < > CHR$(13)  AND XX$ < >"R"  AND XX$ < >"r"  THEN 2150
  216. 2160  POKE 1403,0: VTAB 18: CALL  -868
  217. 2170  IF XX$ = "R"  OR XX$ = "r"  THEN  VTAB 18: CALL  -868: GOTO 2030
  218. 2180  RETURN 
  219. 2190 :
  220. 2200 :
  221. 2210 : REM  [ DISPLAY STATUS ]
  222. 2220  VTAB 19: HTAB 1: CALL  -958: VTAB 19: PRINT : PRINT "Qtr     Empl     Invty     $Cash   $Unit   Prodn   Infln   Salary    $Profit"
  223. 2230  FOR F = 1 TO 76: PRINT "=";: NEXT : PRINT 
  224. 2240  POKE 36,2: PRINT QTR;:AL = EMPL: GOSUB 130: POKE 36,12 -AA: PRINT AL$;:AL = IVTY: GOSUB 130: POKE 36,22 -AA: PRINT AL$;:AL = CASH: GOSUB 130: POKE 36,32 -AA: PRINT AL$;
  225. 2250 AL = UCST: GOSUB 170: POKE 36,40 -AA: PRINT AL$;:AL = PRDN: GOSUB 160: POKE 36,48 -AA: PRINT AL$;:AL = FLTN: GOSUB 170: POKE 36,56 -AA: PRINT AL$;
  226. 2260 AL = SAL: GOSUB 170: POKE 36,65 -AA: PRINT AL$;:AL = CPFT: GOSUB 130: POKE 36,76 -AA: PRINT AL$
  227. 2270  RETURN 
  228. 2280 :
  229. 2290 :
  230. 2300 : REM [ FINAL LETTER ]
  231. 2310  HOME 
  232. 2320  PRINT "Mr/Ms President!": PRINT 
  233. 2330  PRINT "Over your ";TM;" quarters in office, you produced the following results:": PRINT 
  234. 2340 AL = CREV/TM: GOSUB 160: PRINT " Average Revenue.....";: POKE 36,40 -AA -1: PRINT "$";AL$
  235. 2350 AL = CPFT/TM:AV = AL: GOSUB 160: PRINT " Average Profit......";: POKE 36,40 -AA -1: PRINT "$";AL$
  236. 2360 AL = (CLEFT/CEMP) *100:TRN = AL: GOSUB 160: PRINT " Average Turnover....";: POKE 36,40 -AA: PRINT AL$;"%"
  237. 2370 AL = (CPFT/CREV) *100:MGIN = AL: GOSUB 160: PRINT " Average Profit Margin ";: POKE 36,40 -AA: PRINT AL$;"%"
  238. 2380 AL = (CASH +(IVTY *UCST))/(750 +(50 *12)):AL = ((AL *100) -100)/TM:ASET = AL: GOSUB 160: PRINT " Average Asset Return";: POKE 36,40 -AA: PRINT AL$;"%"
  239. 2390  IF MGIN > = 20  THEN MG$ = "is outstanding! Keep it up!":RVW = RVW +4
  240. 2400  IF MGIN > = 10  AND MGIN <20  THEN MG$ = "is very good.  Good expense control!":RVW = RVW +3
  241. 2410  IF MGIN > = 5  AND MGIN <10  THEN MG$ = "could be better.  Analyze your decisions better.":RVW = RVW +2
  242. 2420  IF MGIN <5  THEN MG$ = "is miserable.  You can do better!"
  243. 2430  IF TRN < = 5  THEN TRN$ = "is excellent.  Keep it moving!":RVW = RVW +3
  244. 2440  IF TRN >5  AND TRN < = 10  THEN TRN$ = "is acceptable.  Watch your payroll carefully!":RVW = RVW +2
  245. 2450  IF TRN >10  AND TRN < = 15  THEN TRN$ = "is marginal.  Pay attention to your people!":RVW = RVW +1
  246. 2460  IF TRN >15  THEN TRN$ = "is very poor.  You need more organization stability."
  247. 2470  IF ASET > = 35  THEN AS$ = "is brilliant.  We're delighted with the investment!":RVW = RVW +3
  248. 2480  IF ASET > = 25  AND ASET <35  THEN AS$ = "is acceptable... but watch your cash.":RVW = RVW +2
  249. 2490  IF ASET > = 12  AND ASET <25  THEN AS$ = "is marginal.  We're frankly concerned.":RVW = RVW +1
  250. 2500  IF ASET <12  THEN AS$ = "is unacceptable.  Our investment is disappointing."
  251. 2510  IF BK = 1  THEN  PRINT : PRINT "With these results, you've taken the company into bankruptcy!": PRINT :RVW = 0: GOTO 2570
  252. 2520  PRINT : PRINT "Your profit margin management ";MG$
  253. 2530  PRINT "Your people management ";TRN$
  254. 2540  PRINT "Your asset management ";AS$
  255. 2550  PRINT : IF RVW > = 7  THEN  PRINT "You've done an excellent job in running Widgets Corp.  We'd like to hire you": PRINT "for another term with a bonus of $";:AL =  INT(AV/2): GOSUB 130: PRINT AL$;",000!"
  256. 2560  IF RVW > = 4  AND RVW <7  THEN  PRINT "You've done an adequate job with the company.  We're willing to renew your": PRINT "contract for another term, but we suggest that you pay more attention": PRINT "to the market reports."
  257. 2570  IF RVW <4  THEN  PRINT "You've really done a pitiful job with the assets and resources of the company.": PRINT "We won't be asking you to renew your contract...and please close the door": PRINT "on your way out."
  258. 2580  PRINT : PRINT "The Directors"
  259. 2590  RETURN 
  260. 2600 :
  261. 2610 :
  262. 2620 : REM  [ INTRODUCTION ]
  263. 2630  GOSUB 3390: REM SETUP SCREEN PRINT
  264. 2640  PRINT  CHR$(4);"PR#3"
  265. 2650  HOME : PRINT : HTAB 30: PRINT "*************************": HTAB 30: PRINT "*  WIDGETS CORPORATION  *"
  266. 2660  HTAB 30: PRINT "* A business simulation *": HTAB 30: PRINT "*   by Alexander Laird  *": HTAB 30: PRINT "*************************"
  267. 2670  VTAB 10: HTAB 30: PRINT "     Copyright 1989": HTAB 29: PRINT "   by MindCraft Publ. Corp.": PRINT : HTAB 25: PRINT "<RETURN> TO BEGIN...S)KIP COMMENTS:";: GET XX$: HOME : IF XX$ = "S"  OR XX$ = "s"  THEN 3080
  268. 2680  PRINT "CONGRATULATIONS! You have been elected President of Widget Corporation.  In": PRINT "this important job, you'll select a contract term for decision-making and then"
  269. 2690  PRINT "make a series of management decisions each quarter:"
  270. 2700  PRINT : PRINT "  Payroll ..... $8(000) per employee per quarter"
  271. 2710  PRINT "  Price ....... $9.95 to $29.95"
  272. 2720  PRINT "  Advertising.. $0 to 200(000)"
  273. 2730  PRINT "  Production... Depends on the number of employees and their unit productivity"
  274. 2740  PRINT "  R&D.......... $0 to $200(000)"
  275. 2750  PRINT : PRINT "Widgets are high-tech appliances found in homes and offices.  Although they": PRINT "have a low cost, they take expensive, skilled labor.  If you pay less than the"
  276. 2760  PRINT "$8(000) PER EMPLOYEE per quarter, some employees will leave for other jobs.  If": PRINT "you pay more, then new employees will join the company and begin producing in"
  277. 2770  PRINT "the following quarter.": PRINT : PRINT "Each employee can initially produce 2(000) Widgets per quarter.  However other": PRINT "industry factors such as technology advances, strikes, and damaged goods can"
  278. 2780  PRINT "affect manufacturing cost and productivity."
  279. 2790  PRINT : PRINT "<RETURN> for next page:";: GET XX$: HOME : PRINT "When you start a new quarter, a variety of price, cost, advertising, and R&D"
  280. 2800  PRINT "tables are automatically created.  These tables are used with your decisions to": PRINT "to produce the company performance results."
  281. 2810  PRINT : PRINT "For example: there are built-in advertising and pricing demand tables.  The": PRINT "lower your price, the more you'll sell.  But be careful not to sell below cost"
  282. 2820  PRINT "or you'll lose money.  And if you price above $29.95, you won't sell a single": PRINT "Widget.  Similarly, your advertising expenditures affect the percentage of your"
  283. 2830  PRINT "inventory that is sold each quarter.":
  284. 2840  PRINT : PRINT "You can buy a special Executive Market Report to display the index tables for": PRINT "the current quarter. It costs $50(000) and the price rises by 25% each quarter."
  285. 2850  PRINT : PRINT "Research & Development expense affects the unit cost impact curve. If you spend": PRINT "more, your cost will go down.  Spend less and the cost rises.  You can affect"
  286. 2860  PRINT "the unit cost (up or down) by up to 30% per quarter.": PRINT : PRINT "There is also an inflation factor that affects the payroll expense between"
  287. 2870  PRINT "of 1% to 3% per quarter.  If you don't keep pace with inflation in your payroll": PRINT "then more employees will leave the company."
  288. 2880  PRINT : PRINT "<RETURN> for next page:";: GET XX$
  289. 2890  HOME : PRINT "Here's an example of how the demand curves work using the Price Index:": PRINT : PRINT "   Price Index     R&D Index       Price/Ad Mix"
  290. 2900  PRINT "   9.95   100%       74  30%        60%  40%": PRINT "  15.45    85%      118  15%": PRINT "  18.20    70%      132   0%": PRINT "  20.95    67%      145 -15%": PRINT "  23.20    50%      162 -30%"
  291. 2910  PRINT "  25.45    40%": PRINT "  29.95     0%"
  292. 2920  PRINT : PRINT "With this index, if you set the price at $18.20 to $20.94, you'll sell 70%": PRINT "of the inventory that is affected by price.  In addition, the Price/Ad Index"
  293. 2930  PRINT "shows the relative influence of price and advertising for the quarter.  In the": PRINT "quarter shown, pricing affects 60% of sales and advertising affects only 40%."
  294. 2940  PRINT : PRINT "With the R&D Index, if you spend $1 to 117K your unit cost will rise 30%.  If": PRINT "you spend $145 to 161K, your unit manufacturing cost will be reduced by 15%."
  295. 2950  PRINT : PRINT "These indexes as well as an advertising index are shown when you purchase the": PRINT "special Market Report.  The information can have a dramatic effect on results."
  296. 2960  PRINT : PRINT "<RETURN> for next page:";: GET XX$
  297. 2970  HOME : PRINT "You can also be affected by strikes if you have excessive profits.  When you": PRINT "have a strike, it costs 50% of the current quarter profits to settle it, plus"
  298. 2980  PRINT "double the normal inflation effect in salary increases."
  299. 2990  PRINT : PRINT "Widget's market has several advertising and pricing 'holes' where special": PRINT "promotions may sell out inventory at a relatively high price.  But you'll have"
  300. 3000  PRINT "to experiment to find them."
  301. 3010  PRINT : PRINT "When you have entered your decisions for Payroll, Price, Advertising, Research": PRINT "and Production, your results for the current quarter will be displayed."
  302. 3020  PRINT : PRINT "Each quarter, your results will also be affected by FLASH news reports that": PRINT "can be windfalls or setbacks with: major orders, fire, advertising awards, etc."
  303. 3030  PRINT : PRINT "At the end of your term of office, you'll receive a performance review by the": PRINT "Board of Directors based on your profitability, return on assets, and employee"
  304. 3040  PRINT "management skills.": PRINT : PRINT "Enjoy!  And GOOD LUCK!": PRINT : PRINT "<RETURN> to begin:";: GET XX$
  305. 3050 :
  306. 3060 :
  307. 3070 : REM  [ SETUP MENU ]
  308. 3080 BK = 0:QTR = 1:EMPL = 50:IVTY = 50:CASH = 750:UCST = 12.00:PRDN = 2:FLTN = 1:SAL = 8:CPFT = 0:MKT = 50
  309. 3090  HOME : VTAB 12: HTAB 20: PRINT "Welcome to Widget Corp. Mr/Ms President!": HTAB 20: INPUT "How many Quarters will you serve? (2-12):";TM$:TM =  VAL(TM$): IF TM <2  THEN 3090
  310. 3100 :
  311. 3110 :
  312. 3120 : REM  [ MAIN CONTROL LOOP ]
  313. 3130  HOME 
  314. 3140  GOSUB 1320: REM  BUILD INDEXES
  315. 3150  GOSUB 2220: REM  DISPLAY STATUS
  316. 3160  GOSUB 1740: REM  MARKET REPORT
  317. 3170  GOSUB 2000: REM  ENTER DECISIONS
  318. 3180  GOSUB 1110: REM  FLASH REPORT
  319. 3190  GOSUB 490: REM  CALC OPERATING RESULTS
  320. 3200 CREV = CREV +REV:CPFT = CPFT +PFT:CLEFT = CLEFT +LEMP:CEMP = CEMP +EMPL
  321. 3210  VTAB 1: GOSUB 2220: REM  DISPLAY STATUS
  322. 3220  GOSUB 250: REM  DISPLAY RESULTS
  323. 3230  HTAB 1: VTAB 18: INVERSE : PRINT "PRINT REPORT? Y/N:";: NORMAL : GET XX$: PRINT XX$;: POKE 1403,0: VTAB 18: CALL  -868: IF XX$ < >"Y"  AND XX$ < >"N"  AND XX$ < >"y"  AND XX$ < >"n"  THEN 3230
  324. 3240  IF XX$ = "Y"  OR XX$ = "y"  THEN  CALL 768
  325. 3250 REV = 0:PFT = 0:MCST = 0:RCST = 0:LEMP = 0:NEMP = 0
  326. 3260  IF BK = 0  AND QTR < = TM  THEN 3140: REM CHECK END OF TERM OR BANKRUPTCY
  327. 3270 :
  328. 3280 : REM  [ END OF TERM ]
  329. 3290  VTAB 18: INVERSE : PRINT "Your Term is completed.  Press RETURN for the Directors letter:";: NORMAL : GET XX$
  330. 3300  GOSUB 2310
  331. 3310  VTAB 21: PRINT : INVERSE : PRINT "PRINT LETTER? Y/N:";: NORMAL : GET XX$: VTAB 21: POKE 1403,0: CALL  -868: IF XX$ < >"Y"  AND XX$ < >"N"  AND XX$ < >"n"  AND XX$ < >"y"  THEN 3310
  332. 3320  IF XX$ = "Y"  OR XX$ = "y"  THEN  CALL 768
  333. 3330 XX$ = "": VTAB 21: PRINT : PRINT "ENTER: Q)UIT OR   A)NOTHER TERM:";: GET XX$: IF XX$ < >"A"  AND XX$ < >"Q"  AND XX$ < >"a"  AND XX$ < >"q"  THEN 3330
  334. 3340  IF XX$ = "A"  THEN  CLEAR : GOTO 3080
  335. 3350  PRINT "YOUR TERM IS ENDED.": END 
  336. 3360 :
  337. 3370 :
  338. 3380 : REM  [ SCREEN DUMP M/L ROUTINE ]
  339. 3390  FOR I = 768 TO 911: READ K: POKE I,K: NEXT : RETURN 
  340. 3400  DATA  165, 54, 72, 165, 55, 72, 165, 56, 72, 165, 57, 72, 165, 36, 72, 165, 37, 72, 162, 0, 138, 72, 169, 193, 133, 55, 169, 0, 133, 54, 170, 189, 134, 3, 240, 6, 32, 237, 253, 232, 208, 245, 169, 255, 133, 60, 230, 60, 165, 60
  341. 3410  DATA  133, 37, 32, 36, 252, 160, 0, 173, 0, 192, 201, 155, 240, 44, 104, 72, 208, 14, 8, 120, 141, 85, 192, 177, 40, 141, 84, 192, 40, 32, 237, 253, 177, 40, 32, 237, 253, 200, 192, 40, 208, 221, 169, 141, 32, 237, 253, 234, 234, 234
  342. 3420  DATA  234, 234, 165, 60, 201, 23, 208, 194, 104, 104, 133, 37, 32, 36, 252, 104, 133, 36, 104, 133, 57, 104, 133, 56, 104, 133, 55, 104, 133, 54, 141, 16, 192, 96, 141, 141, 137, 56, 50, 78, 141, 141, 0, 238