80-Bus News

  

May-June 1983, Volume 2, Issue 3











Page 45 of 59











Dah Romana

&

2410 IF move=min+i1 THEN

2420 WRITE (* Well done, you made no >. 240 *mistakes.’)

2440 ELSE

2450 WRITE CIt can be done in *, min, 2460 *"moves’*);

1940 WRITELN(* A number of discs, all dif’, 1950 *ferent in size,”);

1960 WRITELN(* are placed in order on a fixe’, 1970 *"d peg, with the’);

1980 WRITELN(* largest at the bottom. There *, 1990 "are two empty pegs’);

2470 : 2000 WRITELN(’in line with the first. Your ‘, sano Tr nse EN 2010 *task is to move’);

” : wey, 2020 WRITELN(’all the discs to peg 3, one a’, B500 ENDS But that is the WRONG PEG!”); 2030 7t a time, such’); 2510 0 . 2040 WRITELN(*that at no time a larger disc’, 2520 BEGIN 2050 * rests on a"): 25750 REPEAT 2060 WRITELN(’ smaller disc.’); 2540 instruct: 2070 WRITELN; 2550 setgame; 2080 WRITELN(* The maximum number of disc’ ,

2560 REPEAT 2090 "s is’,maxdisce:2,7.7)3; 2570 ; =). 2100 howmany; Clearline(5,13);

2580 WRITE (Shall I demonstrate? *); sto ENDS 2590 READLN; READ Cary);

2130 PROCEDURE play; 2600 clearline(S,15); 2140 VAR ok: BOOLEAN; 2610 okr=(qry="N*) OR (qry="Y")s 2150 err,pl,p2,i,min: INT; 2620 IF NOT ok THEN WRITE (*What??); 2160 BEGIN : 2630 UNTIL oks 2170 REPEAT {until game over} 2640 IF qry=*Y* THEN BEGIN 2180 REPEAT 2650 demonstrate: 2190 clearline (5,13); 2660 REPEAT 2200 WRITE (*Move:’,move) ; 2670 clearline(S5,13); 2210 screen(15,13); 2680 WRITE (’Are you ready to play *, 2220 WRITE (Move disc from peg 7); 2690 “CV/ND? 75 2230 plo := readint; 2700 READLN; READ(Cqry); 2240 ok := (p1>0) AND (p1<4); 2710 okr=(qry="Y") OR (qry="N7);3 2250 IF ok THEN BEGIN 2720 Clearlijne (5,15); 2260 screen(36, 13); 2730 IF NOT ok THEN WRITE (’What?’): 2270 WRITE (to ">: 2740 UNTIL ok; 2280 p2 := readint; 2750 END oe 2290 ok = (p2>0) AND (p2<4); 2760 ELSE qry:="Y"; 2300 END; 2770 IF qry="Y* THEN play; 2310 clearline(5,15); 2780 REPEAT 2320 IF NOT ok THEN 2790 clearline (32,14); 2330 WRITE(’Dont be silly!’); 2800 WRITE (’Again (Y/N)? 7); 2340 UNTIL ok; {valid peg numbers} 2810 READLN; READ (qry)s 2350 errs=movedisc (p1,p2); 2820 ok:=(qry="Y") OR (qry=7N*)3 2360 UNTIL (nf2]=ndises) OR (n£3i=ndiscs); 2830 clearline (32,15); 2370 = min:=1; 2840 IF NOT ok THEN WRITE (?What?’); 2380 FOR i:=1 TO ndiscs DO minz=mint2; 2850 UNTIL ok; 2390 minz=min-1; 2860 UNTIL qry=’N’; 2400) clearline (15,13); 2870 PAGE; 2880 END .

45


This is an OCR’d version of the scanned page and likely contains recognition errors.











Page 45 of 59