Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi Backtrack FloodFill algoritm (https://www.delphipraxis.net/65656-backtrack-floodfill-algoritm.html)

sk.Silvia 19. Mär 2006 16:19


Backtrack FloodFill algoritm
 
hi there, iam trying to make a flood fill alghoritm (i created one using backtracking),the alghoritm is good, but the problem is that it stacks overflow by large inputs (what can i do :wiejetzt: ) i have 2048MB of Ram why i can use only a few kb for programmes...how can i tell delphi that it should use stack up to maximum?

Delphi-Quellcode:
 procedure TCore.SpillDraw(iX,iY:integer);
 var top_ln,bottom_ln,Mode:integer;
     replace_Char:string;

    procedure BacktrackFill(x,y:integer;fill_char,repl_char:char);
        begin
        if not(Edit.Cells[x,y]=fill_char) and (Edit.Cells[x,y]=repl_char) and (x<=Edit.ColCount) and (x>=0) and (y<=Edit.RowCount) and (y>=0) then
            begin
            //showmessage('test');
            Edit.Cells[x,y]:=fill_char;
            BacktrackFill(x,y,fill_char,repl_char);
            BacktrackFill(x-1,y,fill_char,repl_char);
            BacktrackFill(x+1,y,fill_char,repl_char);
            BacktrackFill(x,y-1,fill_char,repl_char);
            BacktrackFill(x,y+1,fill_char,repl_char);
            end;  
        end;

    begin
   
    if (Edit.MouseCoord(ix,iy).X>=0) and (Edit.MouseCoord(ix,iy).X<=Edit.ColCount) and (Edit.MouseCoord(ix,iy).Y>=0) and (Edit.MouseCoord(ix,iy).Y<=Edit.RowCount) then
        begin
        replace_Char:=Edit.Cells[Edit.MouseCoord(ix,iy).X,Edit.MouseCoord(ix,iy).Y];
        BacktrackFill(Edit.MouseCoord(ix,iy).X,Edit.MouseCoord(ix,iy).Y,SelectedChar,replace_Char[1]);
        end;
    end;

-----------------------------------------------------------
CLICK HERE TO BE EATEN BY A VAMPIRE

sk.Silvia 19. Mär 2006 16:39

Re: Backtrack FloodFill algoritm
 
ohh nie mein fehler ich enschuldige mich 1000 mal...es ist ok, we ihr die mach hab delete meine frage...danke...war mein fehler sorry 1000x


Alle Zeitangaben in WEZ +1. Es ist jetzt 04:31 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz