5 ' ** Les cahiers d'Amstrad N"2 - Fevrier 1986 **
10 'PRESENTATION
20 MODE 1
30 SPEED INK 30,30:INK 0,1:PAPER 0:PEN 1
40 BORDER 1
50 ENV 1,10,-1,2 :ENT 1,10,40,2
60 INK 1,2 :INK 2,26:INK 3,6  
70 ' LETTRE D
80 PLOT 30,314,1
90 DRAW 30,379
100 DRAW 90,379:DRAW 110,374:DRAW 110,319:DRAW 90,314:DRAW 30,314
110 PLOT 50,324:DRAW 50,369:DRAW 70,369:DRAW 90,364:DRAW 90,329:DRAW 70,324:DRAW 50,324:DRAW 60,329:PLOT 60,329:DRAW 60,369:PLOT 30,379:DRAW 40,384:DRAW 100,384:DRAW 120,379:DRAW 120,324:DRAW 110,319
120 ' LETTRE A
130 z%=1
140 X%=0
150 PLOT X%+130,314,z%:DRAW X%+130,379:DRAW X%+210,379:DRAW X%+210,314:DRAW X%+190,314:DRAW X%+190,344:DRAW X%+150,344:DRAW X%+150,314:DRAW X%+130,314  
160 PLOT X%+150,354:DRAW X%+150,369:DRAW X%+190,369:DRAW X%+190,354:DRAW X%+150,354
170 PLOT X%+150,314:DRAW X%+160,319:DRAW X%+160,344:PLOT X%+160,354:DRAW X%+160,369:PLOT X%+130,379:DRAW X%+140,384:DRAW X%+220,384:DRAW X%+220,319:DRAW X%+210,314
180 PLOT X%+210,379:DRAW X%+220,384
190 IF Q%=1 THEN GOTO 300
200 'LETTRE L
210 P%=0
220 PLOT P%+310,314,2:DRAW P%+230,314:DRAW P%+230,379:DRAW P%+250,379:DRAW P%+250,324:DRAW P%+310,324:DRAW P%+310,314:DRAW P%+320,319:DRAW P%+320,329:DRAW P%+260,329:DRAW P%+260,384:DRAW P%+240,384:DRAW P%+230,379              
230 PLOT P%+250,379:DRAW P%+260,384:PLOT P%+310,324:DRAW P%+320,329
240 IF W%=1 THEN GOTO 280
250 P%=100
260 W%=1
270 GOTO 220
280 X%=300
290 Q%=1 :z%=3: GOTO 150 
300 PLOT 530,324:DRAW 530,314:DRAW 610,314:DRAW 610,349:DRAW 550,349:DRAW 550,369:DRAW 610,369:DRAW 610,379:DRAW 530,379:DRAW 530,339:DRAW 590,339
310 DRAW 590,324:DRAW 530,324:DRAW 540,329:DRAW 590,329:PLOT 610,314::DRAW 620,324:DRAW 620,354:DRAW 560,354:DRAW 560,369:PLOT 610,369:DRAW 620,374:DRAW 620,384:DRAW 540,384:DRAW 530,379
320 PLOT 610,379:DRAW 620,384:PLOT 610,349:DRAW 620,354
330 PLOT 60,329,1:DRAW 80,329:DRAW 90,331     
340 INK 1,6,24 :INK 2,2,6 :INK 3,24,2
350 TAG
360 FOR x%=-10 TO 215 STEP 5    
370 y%=x%+24
380 IF X%>213 THEN  Q%=2 ELSE Q%=1
390 PLOT 700,450,Q%:MOVE x%,y%:PRINT" PRESENTE PAR";
400 IF X%>213 THEN  Q%=2 ELSE Q%=3
410 PLOT 700,450,Q%:MOVE 400-x%,y%-23:PRINT"GUILLAUME LAMOTHE";
420 NEXT
430 INK 1,2 : INK 2,26 : INK 3,6  
440 BORDER 10
450 ' MUSIQUE
460 DIM n(246,3)
470 T=15
480 FOR i=0 TO 245 STEP 2:READ n(i,2),n(i+1,2):NEXT
490 FOR i=0 TO 245 STEP 2:READ n(i,0),n(i+1,0):NEXT
500 FOR i=0 TO 245 STEP 2:READ n(i,1),n(i+1,1):NEXT
510 FOR i=0 TO 245 STEP 2:SOUND 1,n(i,0),n(i+1,0)*t,7:SOUND 2,n(i,1),n(i+1,1)*t,7:SOUND 4,n(i,2),n(i+1,2)*t,7:NEXT
520 DATA 478,3,239,3,568,1.5,284,4.5,716,3,358,3,638,1.5,319,4.5,478,2,239,1,190,2,239,1,568,2,284,1,239,2,284,1,716,2,358,1,284,2,358,1,638,2,319,1,253,2,319,1,478,2,239,1,190,2,159,1,568,2,284,1,239,2,190,1,716,2
530 DATA 358,1,284,2,239,1,638,2,319,1,253,2,213,1,478,1,239,1,190,1,159,1,190,1,239,1,568,1,284,1,239,1,190,1,239,1,284,1,716,1,358,1,284,1,239,1,284,1,358,1,638,1,319,1,253,1,213,1,253,1,319,1,478,1,190,1,159,1,119,1,159,1,190,1,568,1,239,1,190,1,142,1
540 DATA 190,1,239,1,716,1,284,1,239,1,179,1,239,1,284,1,638,1,253,1,213,1,159,1,213,1,253,1,478,3,190,1,0,1,190,1,568,2,239,2,0,1,239,1,716,3,284,1,0,1,284,1,638,2,253,3,0,1,478,3,239,1,0,1,239,1,568,2,284,2,0,1,284,1,716,3,358,1,0,1,358,1,638,2,319,2,0
550 DATA 1,319,1,716,3,358,3,956,2,239,5
560 DATA 0,3,0,3,0,1.5,0,4.5,0,3,0,3,0,1.5,0,4.5,0,2,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0
570 DATA 1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,3,159,1,0,1,159,1,0,2,190,2,0,1,190,1,0,3,239,1,0,1,239,1,0,2,213,3,0,1,0,3,190,1,0,1,190,1,0
580 DATA 2,239,2,0,1,239,1,0,3,284,1,0,1,284,1,0,2,253,2,0,1,253,1,0,3,284,3,0,2,379,5
590 DATA 0,3,0,3,0,1.5,0,4.5,0,3,0,3,0,1.5,0,4.5,0,2,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0
600 DATA 1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,3,119,1,0,1,119,1,0,2,142,2,0,1,142,1,0,3,179,1,0,1,179,1,0,2,159,3,0,1,0,3,159,1,0,1,159,1,0
610 DATA 2,190,2,0,1,190,1,0,3,239,1,0,1,239,1,0,2,213,2,0,1,213,1,0,3,239,3,0,2,319,5
620 TAGOFF:MODE 2
630 INK 2,20:INK 3,6:INK 0,1:INK 1,24
640 DIM puits(12,3):FOR y=0 TO 11:FOR x=0 TO 2:READ puits(y,x):NEXT x,y
650 DATA 100,50000,,200,70000,,300,75000,,400,80000,,500,90000,,1000,120000,,2000,200000,,5000,400000,,6000,500000,,10000,700000,,15000,1000000,,30000,2500000,
660 DIM etp(10,3):FOR i=0 TO 9:READ etp(i,0),etp(i,1),etp(i,2):NEXT
670 DATA 100,50000,,500,90000,,1000,150000,,5000,400000,,10000,1000000,,15000,1500000,,20000,2000000,,30000,3000000,,40000,4000000,,60000,6000000,
680 DIM bil$(6),bil(6,2):FOR i=0 TO 5:READ bil$(i),bil(i,0),bil(i,1):NEXT:DATA  FINANCES,2,1,PRODUCTION,1,4,SALARIES,2,2,SOMMAIRE,2,5,STOCKAGE,2,3,RETOUR,3,6
690 MODE 2:INPUT"voulez-vous lire le texte d'introduction ";rep$:rep$=UPPER$(rep$):IF LEFT$(rep$,1)="N" THEN GOTO 760
700 MODE 2:BORDER 1:LOCATE 37,1:PRINT"DALLAS"
710 PRINT:PRINT"   Avez-vous jamais reve d'etre milliardaire a la tete d'une entreprise petroli-fere ? Si vous reussissez dans ce jeu,vous pourrez alors etre sur de faire de meme en realite.":PRINT:PRINT"   Mais ATTENTION dans DALLAS un";
720 PRINT" centime de dette et c'est la faillite assuree !"
730 LOCATE 1,10:PRINT"quelques renseignements indispensables :":PRINT:PRINT" - le taux d'emprunt est de 20 %":PRINT" - il faut 1 ingenieur pour 30 ouvriers":PRINT" - il faut 1 chef du personnel pour 30 employes":PRINT" - un ouvrier produit 10 barils par "
;
740 PRINT"jour":PRINT" - un employe garde 1000 barils en stock":PRINT" - la prime de licenciement est de 100000 $ par salarie":PRINT" - la vente d'entrepots ou de puits de petrole rapporte 50 % du prix d'origine"
750 LOCATE 78,24:INPUT j
760 PAPER #3,1:PEN #3,0
770 coba=INT(RND*50)+10
780 ' TEST AVANT JOUR SUIVANT  
790 IF imp2=1 THEN cap=cap*0.5:imp2=0
800 imp=imp+1 :IF imp=60 THEN w$="impots aujourd'hui":GOSUB 3440:imp=1:imp2=1 
810 IF jep=1 AND r3<>0 THEN r4=r4+1
820 IF r4=2 THEN cap=cap-(r2*1.5):r2=0:r3=0:r1=0:jep=0:r4=0 
830 IF jep>1 THEN cap=cap-r3:jep=jep-1  
840 IF jep=1 AND r4=0 THEN w$="remboursement aujourd'hui":GOSUB 3440 
850 joraf=joraf-1:IF joraf=0 THEN baraf=0:reraf=0:joraf1=0:raf1=0:w$="expiration du contrat aujourd'hui":GOSUB 3440
860 IF joraf>0 THEN cap=cap+reraf
870 jj=jj+1
880 ' TEST JOUR SUIVANT
890 cap=cap-(ip+op+cpp+pp)
900 bave=1000+INT(RND*6000)
910 IF coba2=1 THEN coba2=0:coba=10+INT(RND*3)
920 coba1=RND:IF coba1<0.25 THEN coba=coba-INT(RND*10)
930 IF coba1>0.26 THEN coba=coba+INT(RND*5)
940 IF coba1>0.25 AND coba1<0.26 THEN coba=10+INT(RND*3) 
950 IF coba>60 THEN coba=60:coba2=1
960 IF coba<10 THEN coba=10
970 produc=ovr*10:IF produc>promax THEN produc=promax
980 bapr=bapr+produc-baraf
990 IF ing<ovr/30 THEN bapr=bapr-produc/2:w$="ingenieurs pas assez nombreux":GOSUB 3440:w$="la production reelle chute de moitie":GOSUB 3440:IF bapr<0 THEN bapr=0:cap=cap-(reraf*10):raf1=0:baraf=0:reraf=0:joraf=0:v$="rupture du contrat...perte :":
1000 IF cp<per/30 AND stock>0 THEN stock=stock/2:w$="chefs personnels pas assez nombreux":GOSUB 3440:w$="perte de la moitie des stocks":GOSUB 3440
1010 IF bapr<0 THEN bapr=0:cap=cap-(reraf*15):raf1=0:baraf=0:reraf=0:joraf=0:w$="plus de barils pour les raffineries":GOSUB 3440:w$="rupture avec la raffinerie":GOSUB 3440:w$="grosses pertes d'argent !!!":GOSUB 3440
1020 capac=per*1000:IF capac>capmax THEN capac=capmax
1030 IF stock>capac THEN stock=capac
1040 IF bapr>600000 THEN bapr=600000:w$="barils produits trop nombreux ":GOSUB 3440:w$="production stoppee !":GOSUB 3440
1050 d=INT(RND*1000):IF d=50 THEN w$="incendie des vos entrepots":GOSUB 3440:w$="perte de tous vos stocks":GOSUB 3440:w$="les reparations vous cher":GOSUB 3440:cap=cap-1000000:stock=0
1060 d=INT(RND*1000):IF d=50 THEN w$="mort d'un ouvrier !!":GOSUB 3440:w$="les dedommagements coutent cher":GOSUB 3440:ovr=ovr-1:op=op-40:cap=cap-100000
1070 IF CAP<0 THEN GOTO 3480
1080 ' PRESENTATION  
1090 CLS
1100 BORDER 1:INK 1,24:INK 0,1
1110 MODE 2
1120 PRINT" 1 - bilan"
1130 PRINT
1140 IF r2=0 THEN  PRINT" 2 - emprunt"
1150 IF jep=1 THEN PRINT" 3 - remboursement"
1160 IF imp2=1 THEN PRINT" 4 - impots"
1170 PRINT" 5 - engagement"
1180 IF ing=0 AND ovr=0 AND per=0 AND cp=0 THEN GOTO 1190 ELSE PRINT" 6 - licenciements"
1190 PRINT
1200  c=0:FOR i=0 TO 11:c=c+puits(i,2):NEXT:IF c<>12 THEN PRINT" 7 - achat de puits de petrole"
1210  c=0:FOR i=0 TO 11:c=c+puits(i,2):NEXT:IF c<>0 THEN PRINT" 8 - vente de puits de petrole"
1220 IF bapr <>0 THEN PRINT" 9 - vente de barils produits"
1230 IF raf1<>1 AND produc>0 THEN PRINT "10 - contrat avec une raffinerie"
1240 PRINT
1250 c=0:FOR i=0 TO 9:c=c+etp(i,2):NEXT:IF c<>10 THEN PRINT"11 - achat d'entrepots"  
1260 c=0:FOR i=0 TO 9:c=c+etp(i,2):NEXT:IF c<>0 THEN PRINT"12 - vente d'entrepots"  
1270 IF stock<capac THEN PRINT"13 - achat de barils pour stockage"  
1280 IF stock >0 THEN PRINT"14 - vente de barils stockes"
1290 WINDOW #1,55,79,2,7:PAPER #1,1:CLS#1:PEN #1,0  
1300 PRINT#1:PRINT#1," cours du baril :";coba;"$":PRINT#1:PRINT#1," nombre de barils :";bave;"     en vente" 
1310 WINDOW #2,15,26,22,24:PAPER #2,1:CLS#2:PEN #2,0:PRINT#2:PRINT#2," jour :";jj
1320 LOCATE 62,25:INPUT "votre choix ";rep
1330 ON rep GOTO 1350,1840,1990,2050,2100,2360,2610,2710,2800,2900,3010,3100,3180,3350
1340 GOTO 780
1350 ' BILAN
1360 INK 2,20:INK 3,2:w=-1:MODE 1:FOR i=7 TO 17 STEP 4:w=w+2:WINDOW #w,1,12,i,i+2:PAPER #w,3:CLS#w:PEN #w,1:WINDOW #w+1,29,40,i,i+2:PAPER #w+1,3:CLS#w+1:PEN #w+1,1:NEXT
1370 FOR i=1 TO 6:PRINT #i:b$=STRING$(bil(i-1,0),32):PRINT #i,b$;bil$(i-1):NEXT
1380 w=-1:FOR i=7 TO 17 STEP 4:w=w+2:WINDOW #w,14,16,i,i+2:PAPER #w,2:PEN #w,0:CLS#w:WINDOW #w+1,25,27,i,i+2:PAPER #w+1,2:PEN #w+1,0:CLS#w+1:NEXT
1390 FOR i=1 TO 6:PRINT#i:PRINT#i," ";bil(i-1,1):NEXT
1400 PAPER #3,1:PEN #3,0
1410 A$=INKEY$:IF A$="" OR VAL(A$)>6 OR VAL(A$)<1 THEN GOTO 1410
1420 C=VAL(A$):ON C GOTO 1440,1620,1680,1750,1350,1430
1430 PAPER #3,1:PEN #3,0:GOTO 1080
1440 INK 3,6:MODE 2:WINDOW #3,70,79,1,3:CLS #3:PRINT #3:PRINT#3," FINANCES"
1450 PRINT"capital:";cap;"$";:PRINT TAB(50)"jour :";jj
1460 PRINT
1470  IF coem=0 THEN GOTO 1510
1480 PRINT "emprunt :";coem;"$"
1490 PRINT "remboursement total :";r1;"$":PRINT"remboursement journalier :";r3;"$":PRINT"remboursement du dernier jour :";r2;"$"
1500 PRINT"remboursement final au jour :";jep1
1510 PRINT
1520 h=60-imp:PRINT"impots dans";h;"jours"
1530 h=INT(cap*0.35):PRINT"ordre de grandeur (35%) :";h;"$"
1540 PRINT
1550 IF reraf=0 THEN GOTO 1580
1560 PRINT"recette quotidienne du contrat :";reraf;"$"
1570 PRINT"expiration du contrat au jour :";joraf1
1580 h=0:PRINT:FOR i=0 TO 11:h=h+(puits(i,1)/2*puits(i,2)):NEXT:PRINT"capital potentiel (puits) :";h;"$":h=0:FOR i=0 TO 9:h=h+(etp(i,1)/2*etp(i,2)):NEXT:PRINT"capital potentiel (entrepots) :";h;"$"
1590 LOCATE 50,7:PRINT"SALAIRES (/jour) :":LOCATE 50,8:PRINT"ingenieurs        :";ip;"$":LOCATE 50,9:PRINT"ouvriers          :";op;"$":LOCATE 50,10:PRINT"chef du personnel :";cpp;"$":LOCATE 50,11:PRINT"employes          :";pp;"$"
1600 :h=ip+op+pp+cpp:LOCATE 50,13:PRINT"SALAIRES TOTAUX   :";h;"$"
1610 GOTO 1410
1620 MODE 2:WINDOW #3,70,79,1,3:CLS#3:PRINT#3:PRINT#3," SALARIES"
1630 PRINT"CATEGORIE    NOMBRE   SAL.UNITAIRE   SAL.TOTAL":PRINT:PRINT"ingenieurs    ";USING"####";ING;:PRINT TAB(27)"130 $";:PRINT TAB(38)USING"#######";IP;:PRINT" $":PRINT"ouvriers      ";USING"####";OVR;:PRINT TAB(28)"40 $";
1640 PRINT TAB(38)USING"#######";op;:PRINT" $":PRINT"chefs pers.   ";USING"####";cp;:PRINT TAB(28)"70 $";:PRINT TAB(38)USING"#######";cpp;:PRINT" $":PRINT"employes      ";USING"####";PER;:PRINT TAB(28)"35 $";:PRINT TAB(38)USING"#######";CPP;:PRINT" $"
1650 PRINT:PRINT"TOTAUX :     ";:H=ING+OVR+PER+CP:PRINT USING "#####";h;:h=op+ip+cpp+pp:PRINT TAB(37)USING"########";h;:PRINT" $"
1660 h=ovr*10:PRINT:PRINT:PRINT"production maximale des ouvriers :";h;"barils/jour":h=per*1000:PRINT"production reelle :";produc;"barils/jour":PRINT:PRINT"capacite max. de stock. par les employes :";h;"barils":PRINT"capacite reelle :";capac;"barils"
1670 GOTO 1410
1680 MODE 2:WINDOW #3,70,79,1,3:CLS#3:PRINT#3:PRINT#3," STOCKAGE":WINDOW#3,1,30,1,1:CLS#3:PRINT#3,"       NUMERO      CAPACITE":LOCATE 1,3:FOR I=0 TO 9:IF ETP(I,2)=1 THEN PRINT "         ";I;:PRINT TAB(22)USING"#####";ETP(I,0)
1690 NEXT
1700 WINDOW #3,1,30,14,14:CLS#3:PRINT#3,"TOTAUX  ";:H=0:FOR I=0 TO 9:H=H+ETP(I,2):NEXT:PRINT#3,H;:H=0:FOR I=0 TO 9:H=H+ETP(I,0)*ETP(I,2):NEXT:PRINT#3,TAB(21)USING"######";H
1710 LOCATE 1,16:PRINT"capacite maximale de stockage des employes :";per*1000;"barils"
1720 PRINT"capacite reelle :";capac;"barils"
1730 PRINT:PRINT"barils en stock :";stock
1740 GOTO 1410
1750 MODE 2:WINDOW #3,68,79,1,3:CLS#3:PRINT#3:PRINT#3," PRODUCTION"
1760 WINDOW #3,1,30,1,1:PAPER #3,1:CLS#3:PEN#3,0:PRINT#3,"       ";" NUMERO    BARILS/JOUR":LOCATE 1,3:FOR I=0 TO 11:IF puits(i,2)=1 THEN PRINT "         ";:PRINT USING"##";I;
1770 IF puits(i,2)=1 THEN PRINT TAB(21)USING"#####";PUITS(i,0)
1780 NEXT
1790 WINDOW#3,1,30,16,16:PAPER #3,1:CLS#3:PEN#3,0:PRINT#3,"TOTAUX  ";:H=0:FOR I=0 TO 11:H=H+PUITS(I,2):NEXT:PRINT#3, H;:H=0:FOR I=0 TO 11:H=H+PUITS(I,0)*PUITS(I,2):NEXT:PRINT#3, TAB(20)USING"######";H
1800 LOCATE 1,17:PRINT:PRINT"production maximale des ouvriers :";ovr*10
1810 PRINT"production reelle :";produc:PRINT"production nette (-contrat) :";produc-baraf
1820 PRINT:PRINT"barils produits invendus :";bapr
1830 GOTO 1410
1840 CLS'EMPRUNT
1850 IF r2<>0 THEN w$="la banque ne fait qu'un seul pret":GOSUB 3440:GOTO 1080
1860 MODE 2
1870 WINDOW #3,71,79,1,3:CLS#3:PRINT#3:PRINT#3," EMPRUNT"
1880 PRINT"capital :";cap;"$":PRINT:PRINT"emprunt maximal de 100.000 $":INPUT"combien empruntez-vous ";coem:IF coem >100000 THEN w$="espece de voleur !!!":GOSUB 3440:GOTO 1840        
1890 IF COEM<1 THEN W$="ERREUR DE FRAPPE PEUT-ETRE ???":GOSUB 3440:GOTO 1840 
1900 IF INT(coem)<>coem THEN w$="DES COMPTES RONDS  S.V.P. !!":GOSUB 3440:GOTO 1840   
1910 capp=cap+coem:PRINT:PRINT"nouveau capital :";capp;"$":PRINT
1920 PRINT:PRINT"remboursement sur 70 jours maximum"
1930 INPUT"remboursement sur combien de jours ";jep
1940 IF jep>70 THEN w$="avez-vous daigne lire ???":GOSUB 3440:GOTO 1840
1950 IF jep<>INT(jep) THEN w$="c'est nouveau,ca vient de sortir !":GOSUB 3440:GOTO 1840
1960 r1=ROUND(coem*((1.16)^(jep/30))):r3=ROUND(r1/2/(jep-1)):r2=r1-(jep-1)*r3:PRINT"renboursement total :";r1;"$":PRINT"remboursement partiel journalier :";r3;"$":PRINT"remboursement final au jour";jj+jep;":";r2;"$"  
1970 PRINT:INPUT"confirmez-vous cet emprunt ";rep$
1980 IF rep2$="non" THEN coem=0:r1=0:r2=0:r3=0:r4=0:jep=0:jep1=0:GOTO 1080 ELSE cap=capp:jep1=jep+jj:jep=jep+1:GOTO 780
1990 CLS'REMBOURSEMENT
2000 IF jep<>1 THEN w$="vous etes en avance !":GOSUB 3440:GOTO 1080
2010 MODE 2:WINDOW #3,65,79,1,3:CLS#3:PRINT#3:PRINT #3," REMBOURSEMENT" 
2020 PRINT"somme a rembourser aujourd'hui :";r2;"$"
2030 PRINT"en cas d'impossibilite il faut imperativement rembourser demain"
2040 INPUT "pouvez-vous rembourser ";rep$:GOSUB 3470: cap=cap-r2:jep1=0:coem=0:jep=0:r1=0:r2=0:r3=0:r4=0:GOTO 780
2050 CLS' IMPOTS
2060 IF imp2<>1 THEN w$="etes-vous trop riche ??":GOSUB 3440:GOTO 1080
2070 MODE 2:WINDOW #3,72,79,1,3:CLS#3:PRINT#3:PRINT#3," IMPOTS"
2080 PRINT:PRINT"capital :";cap;"$":PRINT:PRINT"impots a 35 % :";INT(cap*0.35);"$":FOR i=1 TO 4000:NEXT
2090 cap=INT(cap*0.75): PRINT:PRINT"nouveau capital :";cap;"$":FOR i=1 TO 17:PRINT:NEXT:INPUT"tapez <ENTER>";u:imp2=0:GOTO 780
2100 MODE 2 ' ENGAGEMENTS
2110 WINDOW #3,67,79,1,3:CLS #3:PRINT #3:PRINT#3," ENGAGEMENTS"
2120 PRINT"1 - ingenieurs":PRINT"2 - ouvriers":PRINT"3 - chef du personnel":PRINT"4 - personnel"
2130 PRINT:INPUT"quelle categorie ";c:IF c<>INT(c) THEN w$="ah! ah! tres drole !":GOSUB 3440:GOTO 2100
2140 IF c<0 OR c>4 THEN w$="bof...trouvez autre chose !":GOSUB 3440:GOTO 2100
2150 ON c GOTO 2160,2210,2260,2310
2160 MODE 2:WINDOW #3,67,79,1,3:CLS #3:PRINT #3:PRINT#3," ENGAGEMENTS"
2170 PRINT"RECRUTEMENT D'INGENIEURS":PRINT:INPUT"combien en embauchez-vous ";c
2180 IF c<>INT(c) OR c<1 THEN w$="ma patience a des limites !":GOSUB 3440:GOTO 2160
2190 h=c*130:PRINT"salaire d'un ingenieur : 130$ / jour":PRINT"depense supplementaire par jour :";h
2200 INPUT"confirmez-vous ces embauches ";rep$:GOSUB 3470:ing=ing+c:ip=ip+h:h=0:c=0:GOTO 780
2210 MODE 2:WINDOW #3,67,79,1,3:CLS #3:PRINT #3:PRINT#3," ENGAGEMENTS"
2220 PRINT"RECRUTEMENT D'OUVIERS":PRINT:INPUT"combien en embauchez-vous ";c
2230 IF c<>INT(c) OR c<1 THEN w$="ma patience a des limites !":GOSUB 3440:GOTO 2160
2240 h=c*40:PRINT"salaire d'un ouvrier : 40$ / jour":PRINT"depense supplementaire par jour :";h
2250 INPUT"confirmez-vous ces embauches ";rep$:GOSUB 3470:ovr=ovr+c:op=op+h:h=0:c=0:GOTO 780
2260 MODE 2:WINDOW #3,67,79,1,3:CLS #3:PRINT #3:PRINT#3," ENGAGEMENTS"
2270 PRINT"RECRUTEMENT DE CHEFS DU PERSONNEL":PRINT:INPUT"combien en embauchez-vous ";c
2280 IF c<>INT(c) OR c<1 THEN w$="ma patience a des limites !":GOSUB 3440:GOTO 2160
2290 h=c*70:PRINT"salaire d'un chef du personnel : 70$ / jour":PRINT"depense supplementaire par jour :";h
2300 INPUT"confirmez-vous ces embauches ";rep$:GOSUB 3470:cp=cp+c:cpp=cpp+h:h=0:c=0:GOTO 780
2310 MODE 2:WINDOW #3,67,79,1,3:CLS #3:PRINT #3:PRINT#3," ENGAGEMENTS"
2320 PRINT"RECRUTEMENT D'EMPLOYES":PRINT:INPUT"combien en embauchez-vous ";c
2330 IF c<>INT(c) OR c<1 THEN w$="ma patience a des limites !":GOSUB 3440:GOTO 2310
2340 h=c*35:PRINT"salaire d'un chef du personnel : 35$ / jour":PRINT"depense supplementaire par jour :";h
2350 INPUT"confirmez-vous ces embauches ";rep$:GOSUB 3470:per=per+c:pp=pp+h:h=0:c=0:GOTO 780
2360 ' LICENCIEMENTS
2370 IF ing=0 AND ovr=0 AND cp=0 AND per=0 THEN w$=" vous n'avez personne a licencier ! ":GOSUB 3440:GOTO 1080 ELSE MODE 2:WINDOW #3,65,79,1,3:PAPER #3,1:CLS #3:PEN #3,0:PRINT#3:PRINT #3," LICENCIEMENTS"
2380 PRINT"1 - ingenieurs":PRINT"2 - ouvriers":PRINT"3 - chef du personnel":PRINT"4 - personnel"
2390 PRINT:INPUT"quelle categorie ";c:IF c<>INT(c) THEN w$="ah! ah! tres drole !":GOSUB 3440:GOTO 2360
2400 ON c GOTO 2410,2460,2510,2560
2410 MODE 2:WINDOW #3,65,79,1,3:CLS #3:PRINT#3:PRINT #3," LICENCIEMENTS"
2420 IF ing=0 THEN w$=" vous n'avez pas d'ingenieurs ":GOSUB 3440:GOTO 1080
2430 INPUT"combien d'ingenieurs voulez-vous licencier ";c:IF c>ing OR c<>INT(c) OR c<0 THEN w$="vous perdez votre temps betement":GOSUB 3440:GOTO 2430
2440 prl=c*24000:gar=c*130:PRINT"prime(s) de licenciement :";prl;"$":PRINT"Par contre vous gagnez par jour :";gar;"$"
2450 INPUT"confirmez-vous ces licenciements ";rep$:GOSUB 3470:cap=cap-prl:ing=ing-c:ip=ip-gar:GOTO 780
2460 MODE 2:WINDOW #3,65,79,1,3:CLS #3:PRINT#3:PRINT #3," LICENCIEMENTS"
2470 IF ovr=0 THEN w$=" vous n'avez pas d'ouvriers ":GOSUB 3440:GOTO 1080
2480 INPUT"combien d'ouvriers voulez-vous licencier ";c:IF c<>INT(c) OR c>ovr THEN w$="ah! ah! tres drole !":GOSUB 3440:GOTO 2460
2490 prl=2160*c:gar=c*40:PRINT"prime(s) de licenciement :";prl;"$":PRINT"Par contre vous gagnez par jour :";gar;"$"
2500 INPUT"confirmez-vous ces licenciements ";rep$:GOSUB 3470:cap=cap-prl:ovr=ovr-c:op=op-gar:GOTO 780
2510 MODE 2:WINDOW #3,65,79,1,3:CLS #3:PRINT#3:PRINT #3," LICENCIEMENTS"
2520 IF cp=0 THEN w$=" vous n'avez pas de chefs du pers. ":GOSUB 3440:GOTO 1080
2530 INPUT"combien de chefs du personnel ";c:IF c<>INT(c) OR c>cp THEN w$="ah! ah! tres drole !":GOSUB 3440:GOTO 2510
2540 prl=15120*c:gar=c*70:PRINT"prime(s) de licenciement :";prl;"$":PRINT"Par contre vous gagnez par jour :";gar;"$"
2550 INPUT"confirmez-vous ces licenciements ";rep$:GOSUB 3470:cap=cap-prl:cp=cp-c:cpp=cpp-gar:GOTO 780
2560 MODE 2:WINDOW #3,65,79,1,3:CLS #3:PRINT#3:PRINT #3," LICENCIEMENTS"
2570 IF per=0 THEN w$=" vous n'avez pas d'employes ":GOSUB 3440:GOTO 1080
2580 INPUT"combien d'employes voulez-vous licencier ";c:IF c<>INT(c) OR c>per THEN w$="ah! ah! tres drole !":GOSUB 3440:GOTO 2560
2590 prl=7560*c:gar=c*35:PRINT"prime(s) de licenciement :";prl;"$":PRINT"Par contre vous gagnez par jour :";gar;"$"
2600 INPUT"confirmez-vous ces licenciements ";rep$:GOSUB 3470:cap=cap-prl:per=per-c:pp=pp-gar:GOTO 780
2610 ' ACHAT DE PUITS
2620 c=0:FOR i=0 TO 11:c=c+puits(i,2):NEXT:IF c=11 THEN w$=" vous avez tout achete ! ":GOSUB 3440:GOTO 1080
2630 MODE 2:WINDOW #3,53,79,1,3:CLS#3:PRINT#3:PRINT#3," ACHAT DE PUITS DE PETROLE "
2640 PRINT:PRINT"NUMERO    BARILS/JOUR       PRIX":PRINT:FOR I=0 TO 11:IF puits(i,2)=0 THEN PRINT "  ";USING"##";I;
2650 IF puits(i,2)<>1 THEN PRINT TAB(13),USING"#####";PUITS(I,0);:PRINT TAB(25),USING"#######";PUITS(I,1);:PRINT"$"
2660 NEXT
2670 LOCATE 53,14:INPUT"quel puits achetez-vous ";c:IF c<>INT(c) OR c<0 OR c>11 THEN w$="faute de frappe peut-etre ??":GOSUB 3440:GOTO 2610 ELSE IF puits(c,2)=1 THEN w$=" il vous appartient deja ! ":GOSUB 3440:GOTO 2610
2680 IF puits(c,1)>cap THEN w$="vous n'avez pas assez d'argent":GOSUB 3440:GOTO 1100
2690 PRINT:PRINT:PRINT"capital actuel :";cap;"$":h=cap-puits(c,1):PRINT"nouveau capital :";h;"$":PRINT:PRINT"production maximale actuelle :";promax;"barils/jour":h=promax+puits(c,0):PRINT"nouvelle production maximale :";h;"barils/jour"
2700 INPUT"confirmez-vous cet achat ";rep$:GOSUB 3470:cap=cap-puits(c,1):promax=promax+puits(c,0):puits (c,2)=1:GOTO 780
2710 ' VENTE DE PUITS DE PETROLE
2720 FOR i=0 TO 11:c=c+puits(i,2):NEXT:IF c=0 THEN w$=" vous ne possedez aucun puits !":GOSUB 3440:GOTO 1080
2730 MODE 2:WINDOW #3,53,79,1,3:CLS#3:PRINT#3:PRINT#3," VENTE DE PUITS DE PETROLE "
2740 PRINT:PRINT"NUMERO    BARILS/JOUR       PRIX":FOR I=0 TO 11:IF puits(i,2)=1 THEN PRINT "  ";USING"##";I;
2750 IF puits(i,2)=1 THEN PRINT TAB(13),USING"#####";PUITS(i,0);:PRINT TAB(25),USING"#######";PUITS(i,1);:PRINT"$"
2760 NEXT
2770 LOCATE 53,12:PRINT"vente a moitie prix":LOCATE 53,13:INPUT"quel puits vendez-vous ";c:IF puits(c,2)=0 THEN w$=" il ne vous appartient pas ! ":GOSUB 3440:GOTO 2710
2780 PRINT:PRINT:PRINT"capital actuel :";cap;"$":h=cap+puits(c,1)/2:PRINT"nouveau capital :";h;"$":PRINT:PRINT"production maximale actuelle :";promax;"barils/jour":h=promax-puits(c,0):PRINT"nouvelle production maximale :";h;"barils/jour"
2790 INPUT"confirmez-vous cette vente ";rep$:GOSUB 3470:cap=cap+puits(c,1)/2:promax=promax-puits(c,0):puits (c,2)=0:GOTO 780
2800 ' VENTE DE BARILS PRODUITS
2810 IF bapr=0 THEN w$="vous n'avez pas de barils a vendre !":GOSUB 3440:GOTO 1080
2820 MODE 2:WINDOW #3,54,79,1,3:CLS #3:PRINT#3:PRINT#3," VENTE DE BARILS PRODUITS "
2830 LOCATE 1,5:PRINT BAPR;"barils produits n'ont pas ete vendus"
2840 PRINT"le cours du baril est :";coba;"$"
2850 h=bapr*coba:PRINT"valeur de votre stock au cours actuel :";h;"$"
2860 PRINT:INPUT"combien en vendez-vous ";c
2870 IF c>bapr OR c<>INT(c) OR c<0 THEN w$="HHUUUUUMMMMMM.......":GOSUB 3440:GOTO 2800
2880 h=c*coba:PRINT"recette de la vente :";h;"$":h=h+cap:PRINT"nouveau capital :";h;"$"
2890 INPUT"confirmez-vous cette vente ";rep$:GOSUB 3470:cap=h:bapr=bapr-c:GOTO 780
2900 'CONTRAT
2910 IF raf1=1 THEN w$="vous avez deja un contrat en cours ":GOSUB 3440:GOTO 1080
2920 MODE 2 :WINDOW #3,50,79,1,3:CLS #3:PRINT #3:PRINT #3," CONTRAT AVEC UNE RAFFINERIE "
2930 LOCATE 1,5:INPUT"combien de barils fournirez-vous a la raffinerie ";c
2940 IF c<>INT(c) OR c<1 OR c>produc THEN w$=" IMPOSSIBLE ":GOSUB 3440:GOTO 2900
2950 PRINT "cours du baril :";coba;"$"
2960 h=c*coba:PRINT"recette journaliere de :";h;"$":h=produc-c:PRINT"production reelle journaliere :";h;"barils"
2970 INPUT"contrat sur combien de jours (20 maxi.) ";c1:IF c1>20 OR INT(c1)<>c1 OR c1<1 THEN w$=" IMPOSSIBLE ":GOSUB 3440:GOTO 2900
2980 h=c1*c*coba:PRINT"recette totale :";h;"$"
2990 INPUT"confirmez-vous ce contrat ";rep$:GOSUB 3470:baraf=c:raf1=1:reraf=baraf*coba:joraf=c1:joraf1=jj+c1
3000 GOTO 780
3010 'ACHAT D'ENTREPOTS
3020 c=0:FOR i=0 TO 9:c=c+etp(i,2):NEXT:IF c=10 THEN w$="vous les possedez tous":GOSUB 3440:GOTO 1080
3030 MODE 2:WINDOW #3,60,79,1,3:CLS#3:PRINT#3:PRINT#3," ACHAT D'ENTREPOTS"
3040 PRINT"NUMERO      CAPACITE        PRIX":PRINT:FOR I=0 TO 9:IF ETP(I,2)=0 THEN PRINT "  ";I;:PRINT TAB(13),USING"#####";ETP(I,0);:PRINT TAB(20),USING"#######";etp(i,1)
3050 NEXT
3060 LOCATE 50,12:INPUT"quel entrepot achetez-vous ";c:IF c<>INT(c) OR c>9 OR c<0 THEN w$="faute de frappe peut-etre ??":GOSUB 3440:GOTO 3010 ELSE IF etp(c,2)=1 THEN w$="vous l'avez deja !":GOSUB 3440:GOTO 3010
3070 IF cap<etp(c,1) THEN w$="vous n'avez pas assez d'argent":GOSUB 3440:GOTO 1080
3080 PRINT "capital actuel :";cap;"$":h=cap-etp(c,1):PRINT"nouveau capital :";h;"$":h=capmax+etp(c,0):PRINT"capacite maximale actuelle :";capmax;"barils":PRINT"nouvelle capacite maximale :";h;"barils"
3090 INPUT"confirmez-vous cet achat ";rep$:GOSUB 3470:capmax=capmax+etp(c,0):etp(c,2)=1:cap=cap-etp(c,1):GOTO 780
3100 ' VENTE D'ENTREPOTS
3110 c=0:FOR i=0 TO 9:c=c+etp(i,2):NEXT:IF c=0 THEN w$="vous n'en avez aucun ":GOSUB 3440:GOTO 1080
3120 MODE 2:WINDOW #3,60,79,1,3:CLS#3:PRINT#3:PRINT#3," VENTE D'ENTREPOTS"
3130 PRINT"NUMERO      CAPACITE        PRIX":PRINT:FOR I=0 TO 9:IF ETP(I,2)=1 THEN PRINT "  ";I;:PRINT TAB(13),USING"#####";ETP(I,0);:PRINT TAB(20),USING"#######";etp(i,1)
3140 NEXT
3150 LOCATE 50,12:INPUT"quel entrepot vendez-vous ";c:IF etp(c,2)=0 THEN w$="vous ne le possedez pas !":GOSUB 3440:GOTO 3100
3160 PRINT "capital actuel :";cap;"$":h=cap+etp(c,1)/2:PRINT"nouveau capital :";h;"$":h=capmax-etp(c,0):PRINT"capacite maximale actuelle :";capmax;"barils":PRINT"nouvelle capacite maximale :";h;"barils"
3170 INPUT"confirmez-vous cette vente ";rep$:GOSUB 3470:capmax=capmax-etp(c,0):etp(c,2)=0:cap=cap+etp(c,1)/2:GOTO 780 
3180 ' ACHAT DE BARILS POUR STOCKAGE
3190 IF capac-stock =0 THEN w$="les entrepots sont pleins":GOSUB 3440:GOTO 1080
3200 MODE 2 :WINDOW #3,49,79,1,3:CLS #3:PRINT #3:PRINT#3," ACHAT DE BARILS POUR STOCKAGE "
3210 PRINT"cours du barils :";coba;"$"
3220 PRINT"nombre de barils en vente :";bave
3230 PRINT"capacite maximale :";capmax;"barils"
3240 PRINT"capacite limite actuelle :";capac;"barils"
3250 h=capac-stock:h=MIN(h,bave):PRINT"achat maximal de :";h;"barils"
3260 INPUT"combien de barils voulez-vous acheter ";c:h=capac-stock:IF c<>INT(c) OR c<1 THEN w$="c'est impossible !!":GOSUB 3440:GOTO 3180
3270 IF c>h AND capac=capmax THEN w$="entrepots trop petits":GOSUB 3440:GOTO 3180
3280 IF c>h THEN w$="personnel pas assez nombreux":GOSUB 3440:GOTO 3180
3290 IF c>bave THEN w$="il n'y en a pas autant a vendre !":GOSUB 3440:GOTO 3180
3300 h=c*coba:PRINT"depense de :";h;"$"
3310 h=cap-h:PRINT"nouveau capital :";h;"$"
3320 INPUT"confirmez-vous cet achat ";rep$:GOSUB 3470:h=c*coba:cap=cap-h:stock=stock+c:GOTO 780
3330 j=0
3340 RETURN
3350 'VENTE DE BARILS
3360 IF stock<1 THEN w$="vous n'en avez pas a vendre !":GOSUB 3440:GOTO 1080
3370 MODE 2:WINDOW #3,55,79,1,3:CLS#3:PRINT#3:PRINT#3," VENTE DE BARILS STOCKES "
3380 PRINT"stock de";stock;"barils"
3390 PRINT"cours du barils :";coba;"$"
3400 INPUT"combien en vendez-vous ";c:IF c>stock OR c=0 OR c<>INT(c) THEN w$="IMPOSSIBLE":GOSUB 3440:GOTO 3350
3410 h=c*coba:PRINT"recette de la vente :";h;"$"
3420 h=cap+h:PRINT"nouveau capital :";h;"$"
3430 INPUT"confirmez-vous cette vente ";rep$:GOSUB 3470:cap=h:stock=stock-c:GOTO 780
3440 MODE 1:INK 2,0:INK 3,6:LONG=LEN(W$):LONG1=INT((40-LONG)/2) :WINDOW #7, LONG1-1,LONG+LONG1,10,12 :PAPER #7,2:CLS#7  
3450 PRINT #7
3460 PEN #7,3:PRINT#7," ";W$:SOUND 1,100,-1,15,1,1:FOR I= 1 TO 2000:NEXT:RETURN 
3470 rep$=UPPER$(rep$):IF LEFT$(rep$,1)="O" THEN RETURN ELSE GOTO 1080
3480 MODE 0
3490 FOR i=0 TO 7:INK i,4:NEXT
3500 WINDOW #1,1,40,1,11:WINDOW #2,1,40,12,25:PAPER #1,0:PAPER #2,1:CLS #1:CLS #2
3510 PEN #1,8:PEN #2,9:SPEED INK 30,30:INK 8,15,4:INK 9,4,15:LOCATE #1,2,2:PRINT#1,"FAILLITE":LOCATE #2,12,12:PRINT#2,"FAILLITE"
3520 FOR i=0 TO 40 STEP 2:PLOT 200,60+i,2:DRAW 310,60+i:DRAW 470,200+i:NEXT i:FOR i=0 TO 110 STEP 2:PLOT 200+i,100:DRAW 360+i,240:NEXT i
3530 FOR i=0 TO 20 STEP 2:PLOT 360+2*i,240+i:DRAW 470-2*i,240+i:NEXT i
3540 FOR i=0 TO 10 STEP 2:PLOT 400,260+i:DRAW 420,260+i:PLOT 390,270+i:DRAW 420,270+i:DRAW 430,280+i:PLOT 390+i,280+i:DRAW 420+i,280+i:PLOT 400+i,290+i:DRAW 420,290+i:NEXT i
3550 PLOT 200,100,3:DRAW 200,60:DRAW 310,60:DRAW 470,200:DRAW 470,240:DRAW 310,100:DRAW 270,120:DRAW 430,260:DRAW 420,260:PLOT 400,260:DRAW 240,120:DRAW 200,100:DRAW 360,240:DRAW 400,260:PLOT 200,100:DRAW 310,100:DRAW 310,60:PLOT 470,240:DRAW 430,260
3560 PLOT 420,260:DRAW 410,250:DRAW 400,250:DRAW 400,270:DRAW 390,270:DRAW 390,280:DRAW 410,300:DRAW 420,300:DRAW 420,290:DRAW 430,290:DRAW 430,280:DRAW 420,270:DRAW 420,260
3570 PLOT 410,250:DRAW 410,270:DRAW 390,270:PLOT 410,270:DRAW 420,270:DRAW 420,280:DRAW 410,280:DRAW 410,290:DRAW 400,290:DRAW 400,280:DRAW 390,280:PLOT 420,300:DRAW 410,290:PLOT 430,290:DRAW 420,280:PLOT 240,120:DRAW 270,120
3580 PLOT 260,399,7:DRAW 230,360:DRAW 300,320:DRAW 280,300:DRAW 290,280:DRAW 285,275:DRAW 310,250
3590 PLOT 240,350,4:DRAW 190,300:DRAW 220,280:DRAW 180,250:PLOT 260,340,6:DRAW 340,370:DRAW 310,340:DRAW 430,370:PLOT 600,399,5:DRAW 540,330:DRAW 600,360:DRAW 510,260
3600 DIM tT(23,2),tu(23,2):FOR I=0 TO 22:READ tT(I,0),tT(I,1):NEXT:FOR I=0 TO 22:READ Tu(I,0),Tu(I,1):NEXT
3610 FOR I=0 TO 22:SOUND 1,tT(I,0),Tu(I,1)*30,7:SOUND 2,Tu(I,0),Tu(I,1)*30,7:NEXT
3620 DATA 239,2,0,1,239,2,0,1,239,2,0,1,201,1,213,1,201,1,213,1,179,1,213,1,201,1,239,2,0,1,119,3,159,2,150,1,159,2,179,1,213,2,201,1,239,4
3630 DATA 478,2,0,1,478,2,0,1,478,2,0,1,402,1,426,1,402,1,426,1,358,1,426,1,402,1,478,2,0,1,239,3,319,2,301,1,319,2,358,1,426,2,402,1,478,4
3640 INK 0,0:INK 1,9:INK 2,3:INK 3,13:INK 4,0:INK 5,0:INK 6,0:INK 7,0:INK 8,0:INK 9,9
3650 FOR i=1 TO 500:NEXT
3660 SPEED INK 2,2
3670 FOR i=4 TO 7:INK i,26:FOR k=1 TO 50:NEXT k:INK i,0:FOR k=1 TO 500:NEXT k:NEXT i
3680 INK 4,13,0:INK 5,13,0:INK 6,13,0:INK 7,13,0:INK 0,0,13:INK 8,0,13
3690 FOR i=1 TO 500:NEXT:INK 0,0:INK 4,0:INK 5,0:INK 6,0:INK 7,0:INK 8,0
3700 FOR g=0 TO 5000:NEXT:INK 0,1:BORDER 1:INK 1,24:MODE 2