It's impossible to have whole scrren broken up into rectangles. The overlapping effect is correct as coded.
e.g. (imagine 0's are undefined areas)
00000
00000
00000
00000
00000
11000
11000
00000
00000
00000
11222
11222
00222
00000
00000
11222
11222
30222
30000
30000
11222
11222
34222
34440
34440
So basically 4 is trying to build a 3*3 sqaure but cannot because you already have filled some with 2's
Run this modified version of your code and all will become clear
RANDOMIZE TIMER()
#CONSTANT MAPX 70
#CONSTANT MAPY 30
CurPosX=0
CurPosY=0
TYPE MapElement
RangeType AS STRING
RangeName AS STRING
RangeNumber AS INTEGER
Symbol AS STRING
colCode AS DWORD
ENDTYPE
DIM Map(MAPX,MAPY) AS MapElement
InitMap() : `SETUP AND INITIALIZE THE MAP AND ALL OF ITS ELEMENTS USING MAP ARRAY
DO : REM MAIN LOOP
SET TEXT OPAQUE
CLS
FOR Y=0 TO MAPY
FOR X=0 TO MAPX
IF X = CurPosX AND Y = CurPosY
INK MAP(X,Y).colCode, RGB(255,0,0)
ELSE
INK MAP(X,Y).colCode, 0
ENDIF
TEXT X * 13, Y * 13, MAP(X,Y).Symbol
NEXT X
NEXT Y
IF UPKEY() THEN CurPosY = CurPosY - 1
IF DOWNKEY() THEN CurPosY = CurPosY + 1
IF RIGHTKEY() THEN CurPosX = CurPosX + 1
IF LEFTKEY() THEN CurPosX = CurPosX - 1
IF CurPosY < 0 THEN CurPosY=0
IF CurPosY > MAPY THEN CurPosY=MAPY
IF CurPosX < 0 THEN CurPosX=0
IF CurPosX > MAPX THEN CurPosX=MAPX
SET CURSOR 45, 500
print CurPosX; " "; CurPosY; " "; MAP(CurPosX,CurPosY).RangeType; " "; MAP(CurPosX,CurPosY).RangeNumber
LOOP
FUNCTION InitMap
FOR Y=0 TO MAPY : `SET DEFAULT VALUES FOR MAP ELEMENTS
FOR X=0 TO MAPX
Map(X,Y).RangeType="uDef"
NEXT X
NEXT Y
eMtNum=0
eGrNum=0
eSnNum=0
eWrNum=0
eHlNum=0
FOR Y=0 TO MAPY : REM GENERATE MAP
FOR X=0 TO MAPX
IF MAP(X,Y).RangeType="uDef"
SELECT RND(4)
CASE 0
eMtNum=eMtNum+1
eSymbol$=str$(eMtNum)
eRangeName$="Mountain"
ecCode=RGB(128,128,128)
ENDCASE
CASE 1
eGrNum=eGrNum+1
eSymbol$=str$(eGrNum) : `GRASS
eRangeName$="Grass"
ecCode=RGB(0,255,0)
ENDCASE
CASE 2
eSnNum=eSnNum+1
eSymbol$=str$(eSnNum) : `SAND
eRangeName$="Sand"
ecCode=RGB(255,128,0)
ENDCASE
CASE 3
eWrNum=eWrNum+1
eSymbol$=str$(eWrNum) : `WATER
eRangeName$="Water"
ecCode=RGB(0,0,255)
ENDCASE
CASE 4
eHlNum=eHlNum+1
eSymbol$=str$(eHlNum) : `HILLS
eRangeName$="Hills"
ecCode=RGB(0,128,0)
ENDCASE
ENDSELECT
ENDIF
IF Map(X,Y).RangeType="uDef"
L=RND(15)+1
W=RND(15)+1
IF X+L > MAPX THEN L = MAPX - X + 1
IF Y+W > MAPY THEN W = MAPY - Y + 1
FOR X2=1 TO L
FOR Y2=1 TO W
IF MAP(X+X2-1, Y+Y2-1).RangeType="uDef"
MAP(X+X2-1, Y+Y2-1).RangeType=eRangeName$
IF eRangeName$="Mountain" THEN MAP(X+X2-1, Y+Y2-1).RangeNumber=eMtNum
IF eRangeName$="Grass" THEN MAP(X+X2-1, Y+Y2-1).RangeNumber=eGrNum
IF eRangeName$="Sand" THEN MAP(X+X2-1, Y+Y2-1).RangeNumber=eSnNum
IF eRangeName$="Water" THEN MAP(X+X2-1, Y+Y2-1).RangeNumber=eWrNum
IF eRangeName$="Hills" THEN MAP(X+X2-1, Y+Y2-1).RangeNumber=eHlNum
MAP(X+X2-1, Y+Y2-1).Symbol=eSymbol$
MAP(X+X2-1, Y+Y2-1).colCode=ecCode
ENDIF
NEXT Y2
NEXT X2
ENDIF
NEXT X
NEXT Y
ENDFUNCTION
If your mansion house needs haunting, just call Rentaghost!