Autor Beitrag
karatekid234
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 18



BeitragVerfasst: Fr 22.12.06 14:39 
Hi,

ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
procedure TForm1.umsetzen(anzahl, von, nach, hilf : integer);
   var lauf: integer;
       s: string;
   begin
   Application.ProcessMessages;
   if aborted=1 then exit;
   s:='';
   for lauf:=0 to 0+anzahl do s:=s+'  ';
   memo1.Lines.add(s+'umsetzen('+inttostr(anzahl)+','+
                   inttostr(von)+','+inttostr(nach)+','+
                   inttostr(hilf)+')');
   if anzahl=1 then setze_eine(von,nach)
   else begin
       umsetzen(anzahl-1,von,hilf,nach);
       setze_eine(von,nach);
       umsetzen(anzahl-1,hilf,nach,von);
       end;
   end;

procedure TForm1.setze_eine(von,nach: integer);
   var jetzt:integer;
   begin
   setze(von,nach);
   progressbar1.position:=versuch+1;
   inc(versuch);
   memo2.Lines.add(inttostr(versuch)+ ':  '+inttostr(von)+' -> '+inttostr(nach));
        Jetzt := GetTickCount + SpinEdit2.value;
        REPEAT
            Application.ProcessMessages;
        UNTIL GetTickCount > Jetzt;
   end;

procedure tform1.setze(von,nach:integer);
begin
if tturmx[von].hheight<tturmx[nach].hheight then
begin
tturmx[von].steine[tturmx[von].hheight].visible:=false;
tturmx[von].hheight:=tturmx[von].hheight-1;
tturmx[nach].steine[tturmx[nach].hheight].Visible:=true;
tturmx[nach].hheight:=tturmx[nach].hheight+1;
end
else if tturmx[nach].hheight=0 then begin
tturmx[von].steine[tturmx[von].hheight].visible:=false;
tturmx[von].hheight:=tturmx[von].hheight-1;
tturmx[nach].steine[tturmx[nach].hheight].Visible:=true;
tturmx[nach].hheight:=tturmx[nach].hheight+1;
end;
end;


Ich habe das Problem, dass dieser Code nur bei 3 Scheiben einigermaßen klappt. Bei mehr als 3 bekomme ich fehler. Kann jemand den Code optimieren, so dass der Code auch bei mehr als 3 Scheiben funktioniert?