ICEBERG DBPRO IMPLEMENTATION
----------------------------
            by
        Kafoolwho


INFO
------

This is a direct implementation of the original Iceberg code translated 
to DBPro


CHANGES FROM ORIGINAL
---------------------

The only changes are added colour and a query to replay the game.


ORIGINAL INSTRUCTIONS
---------------------

Your hull is badly damaged and you've no weapons to speak of.
As you limp slowly home through treacherous iceberg-strewn
waters, you become aware that an enemy ship is tailing you.
Strangely it can detect you, but not the icebergs, so your best
chance of survival is to lure him into hitting one.

Your computer will print a grid showing the position of your 
ship (Y), the enemy (Z) and the icebergs (*).

You can move one space North, South, East or West each go.
The enemy moves towards you by the most direct route (it can
move diagonally too). If you move into any of the 8 positions
surrounding the enemy, you will be captured, and if you hit
an iceberg you will sink.

Can you escape?


ORIGINAL BASIC CODE LISTING (ZX Spectrum)
-----------------------------------------


  10 PRINT "ICEBERG"
  20 DIM b(8,8)
  30 LET n=INT (RND*8+4)
  40 FOR i=1 TO n
  50 LET b(INT (RND*8+1),INT (RND*8+1))=42
  60 NEXT i
  70 LET sx=INT (RND*8+1)
  80 LET sy=INT (RND*8+1)
  90 IF b(sx,sy)<>0 THEN GO TO 70
 100 LET b(sx,sy)=90
 110 LET yx=INT (RND*8+1)
 120 LET yy=INT (RND*8+1)
 130 IF b(yx,yy)<>0 THEN GO TO 110
 140 LET b(yx,yy)=89
 150 CLS
 160 FOR y=1 TO 8
 170 FOR x=1 TO 8
 180 IF b(x,y)=0 THEN GO TO 210
 190 PRINT CHR$ (b(x,y));
 200 GO TO 220
 210 PRINT ".";
 220 PRINT " ";
 230 NEXT x
 240 PRINT
 250 NEXT y
 260 LET b(yx,yy)=0
 270 PRINT "Direction (N,S,E,W) "
 280 INPUT D$
 290 LET yy=yy+(D$="S" AND yy<>8)
 300 LET yy=yy-(D$="N" AND yy<>1)
 310 LET yx=yx+(D$="E" AND yx<>8)
 320 LET yx=yx-(D$="W" AND yx<>1)
 330 IF b(yx,yy)=90 THEN GO TO 500
 340 IF b(yx,yy)=42 THEN GO TO 600
 350 LET b(yx,yy)=89
 360 LET b(sx,sy)=0
 370 LET sx=sx+SGN (yx-sx)
 380 LET sy=sy+SGN (yy-sy)
 390 IF b(sx,sy)=89 THEN GO TO 500
 400 IF b(sx,sy)=42 THEN GO TO 700
 410 LET b(sx,sy)=90
 420 GO TO 150
 500 PRINT "YOU'VE BEEN CAUGHT!"
 510 GO TO 800
 600 PRINT "YOU'VE HIT AN ICEBERG!"
 610 GO TO 800
 700 PRINT "YOU'RE SAFE - HE'S HIT ONE"
 800 PRINT "PLAY AGAIN? ";
 810 INPUT L$
 820 CLS
 830 GO TO 10
