-+-+-+-+-+-+-+-+ START OF PART 2 -+-+-+-+-+-+-+-+ X this_dalek : dalek_pointer; X x,y : integer; X buffer : varying `5B200`5D of char; X spaces : integer; XBEGIN X clear; X posn (1,1); X for y := 1 to 23 do X qio_writeln (VT100_wide); X square (left-1,top-1,right+1,bottom+1); X qio_write (get_posn (2,23)+ X 'LEVEL : '+VT100_bright+dec(level)+VT100_normal+ X get_posn (14,23)+ X 'BEEPS : '+VT100_bright+beep_on_or_off+VT100_normal+ X get_posn (27,23)+ X 'SCORE : '+VT100_bright+dec(score)+VT100_normal); X FOR y := top to bottom do X BEGIN X buffer := ''; X spaces := 100; X FOR x := left to right do X CASE board`5Bx,y`5D of X nothing : spaces := spaces + 1; X dalek : BEGIN X IF ( spaces > 5 ) then X buffer := buffer + get_posn(x,y) + dalek X ELSE X buffer := buffer + pad('',' ',spaces) + dalek; X spaces := 0; X END; X doctor : BEGIN X IF ( spaces > 5 ) then X buffer := buffer + get_posn(x,y) + VT100_graphics_on+' V`60'+VT100_graphics_off X ELSE X buffer := buffer + pad('',' ',spaces) + VT100_graphics V_on+'`60'+VT100_graphics_off; X spaces := 0; X END; X junk : BEGIN X IF ( spaces > 5 ) then X buffer := buffer + get_posn(x,y) + junk X ELSE X buffer := buffer + pad('',' ',spaces) + junk; X spaces := 0; X END; X END; X qio_write (buffer); X END; XEND; X X XPROCEDURE Move_doctor; XVAR X x , y : integer; X threatened : boolean; X command : char; X valid_command : boolean; XBEGIN X REPEAT X posn (1,1); X IF not last_stand then X command := upper_case(qio_1_char) X ELSE X command := '5'; X IF ord(command) = 23 then X refresh; X IF command = 'B' then X BEGIN X beeps_on := not beeps_on; X posn (14,23); X qio_write ('BEEPS : '+VT100_bright+beep_on_or_off+VT100_normal); X END; X CASE command of X '1' : valid_command := ( x_posn > left ) and ( y_posn < bottom ); X '2' : valid_command := ( y_posn < bottom ); X '3' : valid_command := ( x_posn < right ) and ( y_posn < bottom ); X '4' : valid_command := ( x_posn > left ); X '5' : valid_command := true; X '6' : valid_command := ( x_posn < right ); X '7' : valid_command := ( x_posn > left ) and ( y_posn > top ); X '8' : valid_command := ( y_posn > top ); X '9' : valid_command := ( x_posn < right ) and ( y_posn > top ); X 'S' : valid_command := ( screwdriver_used = false ); X 'T' : valid_command := teleport_possible; X 'L' : valid_command := true; X Otherwise valid_command := false; X End; X UNTIL ( valid_command ); X X IF ( command = 'T' ) then X BEGIN X put_on_doctor_with_style; X score := max(score-(2**max(0,level-2)),0); X posn (27,23); X qio_write ('SCORE : '+VT100_bright+dec(score)+VT100_normal); X clear ('LINE','TO_END'); X END; X X IF not last_stand then X BEGIN X board`5Bx_posn,y_posn`5D := nothing; X posn (x_posn,y_posn); X qio_write (nothing); X X IF ( command in `5B'1','2','3'`5D ) then X y_posn := y_posn + 1; X IF ( command in `5B'7','8','9'`5D ) then X y_posn := y_posn - 1; X IF ( command in `5B'1','4','7'`5D ) then X x_posn := x_posn - 1; X IF ( command in `5B'3','6','9'`5D ) then X x_posn := x_posn + 1; X X IF ( command = 'S' ) then X sonic_screwdriver; X X IF ( command = 'L' ) then X BEGIN X last_stand := true; X IF not screwdriver_used then X BEGIN X threatened := false; X FOR x := max(left,x_posn-1) to min(right,x_posn+1) do X FOR y := max(top,y_posn-1) to min(bottom,y_posn+1) do X IF board`5Bx,y`5D = dalek then`20 X threatened := TRUE; X IF threatened then X sonic_screwdriver; X END; X END; X X IF ( board`5Bx_posn,y_posn`5D <> nothing ) then X BEGIN X IF beeps_on then X qio_write (VT100_bell); X doctor_dead := true; X END; X X board`5Bx_posn,y_posn`5D := doctor; X posn (x_posn,y_posn); X qio_write (VT100_graphics_on+'`60'+VT100_graphics_off); X END X ELSE X IF not screwdriver_used then X BEGIN X threatened := false; X FOR x := max(left,x_posn-1) to min(right,x_posn+1) do X FOR y := max(top,y_posn-1) to min(bottom,y_posn+1) do X IF board`5Bx,y`5D = dalek then`20 X threatened := TRUE; X IF threatened then X sonic_screwdriver; X END; XEND; X X XPROCEDURE Move_daleks; XVAR X this_dalek : dalek_pointer; X temp_dalek : dalek_pointer; X old_board : array `5Bleft..right,top..bottom`5D of char; X x, y : integer; X spaces : integer; X bell : boolean; X buffer : varying `5B200`5D of char; XBEGIN X old_board := board; X this_dalek := head_dalek; X WHILE ( this_dalek <> nil ) do X BEGIN X board`5Bthis_dalek`5E.x,this_dalek`5E.y`5D := nothing; X this_dalek := this_dalek`5E.next; X END; X X this_dalek := head_dalek; X WHILE ( this_dalek <> nil ) do X BEGIN X this_dalek`5E.x := this_dalek`5E.x + sign(x_posn-this_dalek`5E.x); X this_dalek`5E.y := this_dalek`5E.y + sign(y_posn-this_dalek`5E.y); X X IF ( board`5Bthis_dalek`5E.x,this_dalek`5E.y`5D = doctor ) then X doctor_dead := true; X IF ( board`5Bthis_dalek`5E.x,this_dalek`5E.y`5D = dalek ) then X board`5Bthis_dalek`5E.x,this_dalek`5E.y`5D := junk; X IF ( board`5Bthis_dalek`5E.x,this_dalek`5E.y`5D = junk ) then X old_board`5Bthis_dalek`5E.x,this_dalek`5E.y`5D := nothing; X IF ( board`5Bthis_dalek`5E.x,this_dalek`5E.y`5D = nothing ) then X board`5Bthis_dalek`5E.x,this_dalek`5E.y`5D := dalek; X X this_dalek := this_dalek`5E.next; X END; X X`7B restore screen `7D X FOR y := top to bottom do X BEGIN X spaces := 100; X buffer := ''; X bell := false; X FOR x := left to right do X IF ( board`5Bx,y`5D <> old_board`5Bx,y`5D ) then X BEGIN X IF beeps_on and ( board`5Bx,y`5D = junk ) then X bell := true; X IF ( spaces > 5 ) then X buffer := buffer + get_posn(x,y) + board`5Bx,y`5D X ELSE X buffer := buffer + move_right(spaces) + board`5Bx,y`5D; X spaces := 0; X END X ELSE X spaces := spaces + 1; X IF bell then X buffer := buffer + VT100_bell; X qio_write (buffer); X END; X X X this_dalek := head_dalek; X WHILE ( this_dalek <> nil ) do X BEGIN X IF ( board`5Bthis_dalek`5E.x,this_dalek`5E.y`5D = junk ) then X BEGIN X IF ( this_dalek`5E.prev = nil ) then X head_dalek := head_dalek`5E.next X ELSE X this_dalek`5E.prev`5E.next := this_dalek`5E.next; X IF ( this_dalek`5E.next <> nil ) then X this_dalek`5E.next`5E.prev := this_dalek`5E.prev; X temp_dalek := this_dalek; X this_dalek := this_dalek`5E.next; X DISPOSE (temp_dalek); X score := score + 1 + ord(last_stand); X posn (27,23); X qio_write ('SCORE : '+VT100_bright+dec(score)+VT100_normal); X END X ELSE X this_dalek := this_dalek`5E.next; X END; X X IF doctor_dead and beeps_on then X qio_write (VT100_bell); X daleks_dead := ( head_dalek = nil ); XEND; X X XPROCEDURE Explode_doctor; XVAR X x , y , i : integer; XBEGIN X FOR y := max(top,y_posn-2) to min(y_posn+2,bottom) do X FOR x := max(left,x_posn-2) to min(x_posn+2,right) do X BEGIN X posn (x,y); X i := random(3); X IF i = 1 then X qio_write (' ') X ELSE X qio_write ('.'); X END; X X FOR y := max(top,y_posn-2) to min(y_posn+2,bottom) do X FOR x := max(left,x_posn-2) to min(x_posn+2,right) do X BEGIN X posn (x,y); X CASE board`5Bx,y`5D of X nothing : qio_write (nothing); X doctor : qio_write (junk); X dalek : qio_write (dalek); X junk : qio_write (junk); X END; X END; X sleep(sec:=1); XEND; X X XBEGIN X initialize; X REPEAT X setup; X REPEAT X move_doctor; X move_daleks; X UNTIL ( doctor_dead ) or ( daleks_dead ); X IF doctor_dead then X explode_doctor X ELSE X BEGIN X posn (1,23); X clear('LINE'); X qio_write (VT100_bright+'Please Wait ...'+VT100_normal); X sleep(sec:=2); X END; X UNTIL ( doctor_dead ) or ( level = 10 ) ; X Top_ten (score); XEND. $ CALL UNPACK DALEKS.PAS;1 542027304 $ create 'f' X`1B`5BH`1B`5BJ`1B(B`1B`5B0m X`1B`5B1;1H`1B#3`1B`5B1;13HD A L E K S`1B`5B2;1H`1B#4`1B`5B2;13HD A L E K S`1 VB`5B3;1H`1B#6`1B(0lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk`1B`5B4;1H`1B#4lqqqqq Vqqqqqqqqqqqqqqqq X`1B`5B4;23Hqqqqqqqqqqqqqqk`1B`5B5;1H`1B#6x `1B(B`5E`1B`5B5;37H`1B(0x`1B`5 VB6;1H`1B#6x `1B(B\ `7C / T .. Teleport`1B`5B6;37H`1B(0x X`1B`5B7;1H`1B#6x 7 8 9 `1B`5B7;37Hx`1B`5B8;1H`1B#6x`1B`5B8;14H S `1B(B.. V Sonic Screwdriver`1B(0x`1B`5B9;1H`1B#6x`1B(B<-4 5 6->`1B`5B9;37H`1B(0x X`1B`5B10;1H`1B#6x`1B`5B10;13H L `1B(B.. Last Stand `1B(0x`1B`5B11;1H` V1B#6x 1 2 3 `1B`5B11;37Hx`1B`5B12;1H`1B#6x `1B(B/ `7C \ B .. Beeps V ON/OFF `20 X`1B`5B12;37H`1B(0x`1B`5B13;1H`1B#6x V `1B`5B13;37Hx`1B`5B14;1H`1B#6x V`1B`5B14;37Hx`1B`5B15;1H`1B#6x A`1B(Bim : Make Daleks Run Into Each `1B(0x X`1B`5B16;1H`1B#6x`1B`5B16;17HO`1B(Bther.`1B`5B16;37H`1B(0x`1B`5B17;1H`1B#6x V x`1B`5B18;1H`1B#6x A`1B(Bnother Software V Group Produ X`1B`5B18;31Hction `1B(0x`1B`5B19;1H`1B#6x V x`1B`5B20;1H`1B#6x`1B`5B20;13HP`1B(Baul D Venize`1B`5B20;37H`1B(0x X`1B`5B21;1H`1B#6mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj`1B`5B22;1H`1B#6`1B`5B2 V3;1H`1B#6`1B`5B23;11HP`1B(Bress <`1B`5B7mRETURN`1B`5B0m>`1B`5B1;1H X`1B* $ CALL UNPACK DALEKS.PIC;1 929903770 $ v=f$verify(v) $ EXIT