大家快来看!我编的七色地图PASCAL源程序!不进来后悔N辈子!!
pascal吧
全部回复
仅看楼主
level 6
Au197💍 楼主
1L百度
2009年08月06日 09点08分 1
level 6
Au197💍 楼主
program colormap;
const
  co:array[0..7]of longint
  =(0,$ff0000,$ff8000,$ffff00,$00ff00,$00ffff,$0000ff,$ff00ff);
  head:array[0..53]of byte
  =(66,77,54,00,03,00,00,00,
    00,00,54,00,00,00,40,00,
    00,00,00,01,00,00,00,01,
    00,00,01,00,24,00,00,00,
    00,00,00,00,03,00,00,00,
    00,00,00,00,00,00,00,00,
    00,00,00,00,00,00);
  dx:array[0..3]of longint=(0,1,0,-1);
  dy:array[0..3]of longint=(1,0,-1,0);
var
  fi:file of byte;
  a:array[0..255,0..255]of longint;
  qx,qy:array[0..7,0..65535]of longint;
  i,j,x,y,wb,wb1,ff:longint;
  f,r,sx,sy:array[0..7]of longint;
  red,green,blue:byte;
  success:boolean;
procedure extendc(color:longint);
begin
  for i:=1 to 7 do
  begin
    ff:=f[i];
    while ff<=r[i] do
    begin
      for j:=0 to 3 do
      begin
        x:=qx[i,ff]+dx[j];y:=qy[i,ff]+dy[j];
        if x>=0 then
        if x<256 then
        if y>=0 then
        if y<256 then
        if a[x,y]=color then
        begin
          inc(r[i]);
          dec(wb);
          qx[i,r[i]]:=x;
          qy[i,r[i]]:=y;
          a[x,y]:=co[i];
        end;
      end;
      inc(ff);
    end;
  end;
end;
procedure simpize;
var
  i1,j1,x1,y1,bj1:longint;
begin
  for i1:=1 to 7 do
  begin
    while f[i1]<=r[i1] do
    begin
      bj1:=0;
      for j1:=0 to 3 do
      begin
        x1:=qx[i1,f[i1]]+dx[j];
        y1:=qy[i1,f[i1]]+dy[j];

2009年08月06日 09点08分 2
level 6
Au197💍 楼主
        if x1>=0 then
        if x1<256 then
        if y1>=0 then
        if y1<256 then
        if
        (a[x1,y1]=$000000)or
        (a[x1,y1]=$ffffff)then
        bj1:=1;
      end;
      if bj1=0 then
      inc(f[i1])
      else break;
    end;
  end;
end;
begin
  randomize;
  assign(fi,'colormap.bmp');rewrite(fi);
  for i:=0 to 53 do write(fi,head[i]);
  success:=false;
  repeat
    for i:=0 to 255 do
    for j:=0 to 255 do
    a[i,j]:=random(2)*$ffffff;
    for i:=1 to 7 do
    begin
      sx[i]:=random(256);
      sy[i]:=random(256);
    end;
    for i:=1 to 7 do
    a[sx[i],sy[i]]:=co[i];
    wb:=65529;wb1:=65535;
    for i:=1 to 7 do
    begin
      qx[i,0]:=sx[i];
      qy[i,0]:=sy[i];
      f[i]:=0;r[i]:=0;
    end;
    success:=true;
    while wb>0 do
    begin
      if wb=wb1 then
      begin
        success:=false;
        break;
      end;
      wb1:=wb;
      extendc($ffffff);
      simpize;
      extendc($000000);
      simpize;
    end;
  until success;
  for i:=0 to 255 do
  for j:=0 to 255 do
  begin
    red:=a[i,j] shr 16;
    green:=a[i,j] shr 8 and 255;
    blue:=a[i,j] and 255;
    write(fi,blue,green,red);
  end;
  close(fi);
end.
2009年08月06日 09点08分 3
level 5
顶强帖,看不懂
2009年08月08日 03点08分 4
level 6
Au197💍 楼主
复制回去
2009年08月09日 08点08分 5
level 0
没看到结果
2009年08月09日 11点08分 6
level 6
暂时没看到关于屏幕字体颜色操作的语句
2009年08月09日 12点08分 7
level 6
这个...对游戏的截屏有帮助...
2009年08月09日 13点08分 8
level 6
Au197💍 楼主
结果在colormap.bmp中。
2009年08月11日 01点08分 9
level 5
看不懂
2009年08月11日 08点08分 10
level 1
没看懂
不是搜索不就可以了吗?
2009年08月11日 14点08分 11
level 6
Au197💍 楼主
colormap.bmp在程序所在文件夹中
2009年08月12日 09点08分 12
level 6
Au197💍 楼主
ddddddddddddddd
2009年08月15日 03点08分 13
level 0
太长了,用回朔在家for循环就行了。
2009年08月15日 06点08分 14
level 11
似懂非懂,楼主颇有情趣。洒家只是一菜鸟而已。
Good luck
2009年08月18日 09点08分 15
level 6
Au197💍 楼主
效果如何?
2009年08月18日 11点08分 16
level 0
新算法么?~!!
2009年08月21日 05点08分 17
level 6
Au197💍 楼主
说新也不新。
2009年08月23日 08点08分 18
level 6
Au197💍 楼主
d
2009年08月25日 09点08分 19
level 6
Au197💍 楼主
好,我现在顶贴不发D了,我凑满十五字,还说我找抽。
2009年08月27日 10点08分 20
1 2 尾页