1 REM +++++++++++++++++++++++++++++++ 2 REM ! Program .... B]TRESAN.BAS 3 REM ! Utg}va 1.0 1983 4 REM ! av Alf Wirdling <4230> 5 REM ! Tel. 0470-26277 / V[XJ\ 6 REM ! Minne 16 Kbytes 7 REM ! Screening TES 8 REM +++++++++++++++++++++++++++++++ 9 REM 10 REM Klassisk problem att l|sa. 11 REM Presenteras i grafik och text. 12 REM 110 ; CHR$(12);TAB(15);"B]TRESAN" 120 ; TAB(15);"========" 130 ; : ; "Du skall ta dig |ver med b}t fr}n en" 140 ; "strand till en annan." 150 ; : ; "Med dig har du en varg" 160 ; " ett lamm" 170 ; " ett k}lhuvud." 180 ; : ; "Du kan bara ta med dig en 'sak'" 190 ; "i taget." 200 ; : ; "Hur skall du g|ra f|r att ro problemet" 210 ; "i land ???" 220 ; CUR(23,0);"TRYCK RETURN N[R DU L[ST F[RDIGT "; 230 POKE 65013,0 : GET R$ 240 REM  DEFINIERA F\REM]LEN  250 REM 260 REM  B]TEN  270 B1$=" " 280 B2$=" " 290 B3$="+'" 300 REM  MANNEN  310 M1$=" j= " 320 M2$="  " 330 REM  INGENTING  340 I1$=" " 350 I2$=" " 360 REM  VARGEN  370 V1$=" hp " 380 V2$="7k " 390 REM  LAMMET  400 L1$=" ` " 410 L2$="hn! " 420 REM  K]LHUVUDET  430 K1$=" " 440 K2$=" | " 450 REM  DEFINIERA STRANDEN  460 ; CHR$(12) 470 FOR I%=0% TO 18% 480 ; CUR(I%,0%);CHR$(151); 490 NEXT I% 500 FOR I%=2% TO 79% 510 SETDOT 6%,I% : SETDOT 50%,I% 520 NEXT I% 530 REM  PLACERA UT MANNEN  540 REM  OCH SJ\S[TT B]TEN  550 B1$=M1$+I1$ : B2$=M2$+I2$ 560 ; CUR(14%,15%);B1$; 570 ; CUR(15%,15%);B2$; 580 ; CUR(16%,15%);B3$; 590 REM  PLACERA UT F\REM]LEN  600 ; CUR(17%,13%);V1$; 610 ; CUR(18%,13%);V2$; 620 ; CUR(17%,17%);K1$; 630 ; CUR(18%,17%);K2$; 640 ; CUR(17%,21%);L1$; 650 ; CUR(18%,21%);L2$; 660 REM  INITIERA STRAND-F\REM]LEN  670 S1$(1)="V" : S1$(2)="K" : S1$(3)="L" 680 S2$(1)=" " : S2$(2)=" " : S2$(3)=" " 690 S%=1% : REM  AKT. STRAND  700 REM  MAIN LOOP  710 FOR H%=1 TO 10% : ; CHR$(7); 720 ON S% GOTO 730,740 730 T$(1)=S1$(1) : T$(2)=S1$(2) : T$(3)=S1$(3) : GOTO 750 740 T$(1)=S2$(1) : T$(2)=S2$(2) : T$(3)=S2$(3) 750 GOSUB 2150 : REM  SPACE  760 ; CUR(20%,9%);"--- B]TRESA NR:";H%;" ---"; 770 ; CUR(21%,5%);"VAD VILL DU TA MED DIG ?????"; 780 ; CUR(22%,1%);"V=VARG K=K]LHUVUD L=LAMM I=INGENTING "; 790 GET R$ : ; R$ 800 IF R$="V" OR R$="v" GOTO 850 810 IF R$="K" OR R$="k" GOTO 950 820 IF R$="L" OR R$="l" GOTO 1050 830 IF R$="I" OR R$="i" GOTO 1150 840 GOTO 780 : REM  FEL VAL  850 REM  VARG  860 IF T$(1)<>"V" THEN 780 870 B1$=M1$+V1$ : B2$=M2$+V2$ 880 ON S% GOTO 890,920 890 ; CUR(17%,13%);I1$; 900 ; CUR(18%,13%);I2$; 910 S1$(1)=" " : GOTO 1170 920 ; CUR(0%,13%);I1$; 930 ; CUR(1%,13%);I2$; 940 S2$(1)=" " : GOTO 1170 950 REM  K]LHUVUD  960 IF T$(2)<>"K" THEN 780 970 B1$=M1$+K1$ : B2$=M2$+K2$ 980 ON S% GOTO 990,1020 990 ; CUR(17%,17%);I1$; 1000 ; CUR(18%,17%);I2$; 1010 S1$(2)=" " : GOTO 1170 1020 ; CUR(0%,17%);I1$; 1030 ; CUR(1%,17%);I2$; 1040 S2$(2)=" " : GOTO 1170 1050 REM  LAMM  1060 IF T$(3)<>"L" THEN 780 1070 B1$=M1$+L1$ : B2$=M2$+L2$ 1080 ON S% GOTO 1090,1120 1090 ; CUR(17%,21%);I1$; 1100 ; CUR(18%,21%);I2$; 1110 S1$(3)=" " : GOTO 1170 1120 ; CUR(0%,21%);I1$; 1130 ; CUR(1%,21%);I2$; 1140 S2$(3)=" " : GOTO 1170 1150 REM  INGENTING  1160 B1$=M1$+I1$ : B2$=M2$+I2$ 1170 REM  NY B]TBILD  1180 ON S% GOTO 1190,1220 1190 ; CUR(14%,15%);B1$; 1200 ; CUR(15%,15%);B2$; 1210 GOTO 1240 1220 ; CUR(2%,15%);B1$; 1230 ; CUR(3%,15%);B2$; 1240 REM  B]TRESAN  1250 ON S% GOTO 1260,1510 1260 REM  TILL NORRA STRANDEN  1270 FOR I%=13% TO 2% STEP -1% 1280 ; CUR(I%+0%,15%);B1$; 1290 ; CUR(I%+1%,15%);B2$; 1300 ; CUR(I%+2%,15%);B3$; 1310 ; CUR(I%+3%,15%);SPACE$(8%); 1320 IF I%=8% THEN GOSUB 1850 1330 GOSUB 2200 : NEXT I% : S%=2% 1340 ; CUR(16%,15%);"pppppppp"; 1350 IF R$<>"V" AND R$<>"v" THEN 1390 1360 ; CUR(0%,13%);V1$; 1370 ; CUR(1%,13%);V2$; 1380 S2$(1)="V" : GOTO 1470 1390 IF R$<>"K" AND R$<>"k" THEN 1430 1400 ; CUR(0%,17%);K1$; 1410 ; CUR(1%,17%);K2$; 1420 S2$(2)="K" : GOTO 1470 1430 IF R$<>"L" AND R$<>"l" THEN 1750 1440 ; CUR(0%,21%);L1$; 1450 ; CUR(1%,21%);L2$; 1460 S2$(3)="L" : GOTO 1470 1470 REM  B]TEN [R TOM  1480 ; CUR(2%,19%);I1$; 1490 ; CUR(3%,19%);I2$; 1500 GOTO 1750 1510 REM  TILL S\DRA STRANDEN  1520 FOR I%=5% TO 16% 1530 ; CUR(I%-0%,15%);B3$; 1540 ; CUR(I%-1%,15%);B2$; 1550 ; CUR(I%-2%,15%);B1$; 1560 ; CUR(I%-3%,15%);SPACE$(8%); 1570 IF I%=10% THEN GOSUB 1850 1580 GOSUB 2200 : NEXT I% : S%=1% 1590 ; CUR(2%,15%);"########"; 1600 IF R$<>"V" AND R$<>"v" THEN 1640 1610 ; CUR(17%,13%);V1$; 1620 ; CUR(18%,13%);V2$; 1630 S1$(1)="V" : GOTO 1720 1640 IF R$<>"K" AND R$<>"k" THEN 1680 1650 ; CUR(17%,17%);K1$; 1660 ; CUR(18%,17%);K2$; 1670 S1$(2)="K" : GOTO 1720 1680 IF R$<>"L" AND R$<>"l" THEN 1750 1690 ; CUR(17%,21%);L1$; 1700 ; CUR(18%,21%);L2$; 1710 S1$(3)="L" 1720 REM  B]TEN [R TOM  1730 ; CUR(14%,19%);I1$; 1740 ; CUR(15%,19%);I2$; 1750 REM  [R PROBLEMET ROTT ILAND ?  1760 IF NOT (S2$(1)="V" AND S2$(2)="K" AND S2$(3)="L") THEN 1800 1770 GOSUB 2150 : REM  SPACE  1780 ; CUR(20%,1%);"DU LYCKADES - BRA ROTT !!!!!!!!!!!!!!!" 1790 OUT 6,5 : GOSUB 2230 : OUT 6,0 : END 1800 NEXT H% 1810 REM  10 B]TRESOR GJORDA !!!  1820 GOSUB 2150 : REM  SPACE  1830 ; CUR(20%,1%);"EFTER 10 B]TRESOR HAR DU INTE LYCKATS!" 1840 OUT 6,43 : GOSUB 2230 : OUT 6,0 : END 1850 REM  [R DET ETT TOKIGT VAL ???  1860 ON S% GOTO 1870,1990 1870 IF NOT (S1$(1)="V" AND S1$(3)="L") THEN 1930 1880 ; CUR(17%,13%);I1$; 1890 ; CUR(18%,13%);I2$; 1900 ; CUR(17%,21%);V1$; 1910 ; CUR(18%,21%);V2$; 1920 GOTO 2100 1930 IF NOT (S1$(2)="K" AND S1$(3)="L") THEN RETURN 1940 ; CUR(17%,21%);I1$; 1950 ; CUR(18%,21%);I2$; 1960 ; CUR(17%,17%);L1$; 1970 ; CUR(18%,17%);L2$; 1980 GOTO 2100 1990 IF NOT (S2$(1)="V" AND S2$(3)="L") THEN 2050 2000 ; CUR(0%,13%);I1$; 2010 ; CUR(1%,13%);I2$; 2020 ; CUR(0%,21%);V1$; 2030 ; CUR(1%,21%);V2$; 2040 GOTO 2100 2050 IF NOT (S2$(2)="K" AND S2$(3)="L") THEN RETURN 2060 ; CUR(0%,21%);I1$; 2070 ; CUR(1%,21%);I2$; 2080 ; CUR(0%,17%);L1$; 2090 ; CUR(1%,17%);L2$; 2100 REM  ETT MYCKET TOKIGT VAL !!!  2110 GOSUB 2150 : REM  SPACE  2120 ; CUR(20%,1%);"DET VAR V[L INTE S] KLYFTIGT VA !!!" 2130 OUT 6,25 : GOSUB 2230 : OUT 6,0 : END 2140 RETURN 2150 REM  UTBLANKA FR]G-RADER  2160 ; CUR(20%,1%);SPACE$(38%); 2170 ; CUR(21%,1%);SPACE$(38%); 2180 ; CUR(22%,1%);SPACE$(38%); 2190 RETURN 2200 REM  F\RDR\JNING  2210 FOR F=1 TO 200 : NEXT F 2220 RETURN 2230 REM  F\RDR\JNING 2  2240 FOR F=1 TO 4000 : NEXT F 2250 RETURN