function TForm1.BlockSet(ix,jy:Integer):Integer; begin // FBord[ix,jy1] 0 --> 背景、1 --> 壁、2 --> ブロック Result := 1; if jy+1 <= YMAX then //下へ(1) if FBord[ix,jy+1] =0 then begin FBord[ix,jy+1] := 2; Result := Result + SubPaint(ix,jy+1); end; if jy-1 >= 0 then //上へ(2) if FBord[ix,jy-1] =0 then begin FBord[ix,jy-1] := 2; Result := Result + SubPaint(ix,jy-1); end; if ix+1 <= XMAX then //右へ(3) if FBord[ix+1,jy] =0 then begin FBord[ix+1,jy] := 2; Result := Result + SubPaint(ix+1,jy); end; if ix-1 >= 0 then //左へ(4) if FBord[ix-1,jy] =0 then begin FBord[ix-1,jy] := 2; Result := Result + SubPaint(ix-1,jy); end; end; //使い方 for j := 0 to YMAX do for i := 0 to XMAX do ImageList1.Draw(offBmp.Canvas, i*DOT, j*DOT, FBord[i,j]);