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; |