Einzelnen Beitrag anzeigen

Benutzerbild von Sir Rufo
Sir Rufo

Registriert seit: 5. Jan 2005
Ort: Stadthagen
9.454 Beiträge
 
Delphi 10 Seattle Enterprise
 
#8

Re: Programmierung Türme von Hanoi

  Alt 15. Feb 2010, 18:30
ich glaube nicht, dass deine funktion so compiliert wird.
da fehlt jede Menge "end;"
Würde man auch sofort sehen, wenn man sich etwas an den Style-Guide von Delphi halten würde:
Delphi-Quellcode:
procedure bewegen( start, ziel : integer );
  var
    safe, Auswahl1, Auswahl2, Auswahl3, a, s1a, s2a, s3a : integer;
  begin
    s1a := strtoint( edit5.Text );
    s2a := 0;
    s3a := 0;
    Auswahl1 := s1a;
    Auswahl2 := s2a;
    Auswahl3 := s3a;

    if ( start = 1 ) and ( ziel = 2 ) then
      safe := 12;
    if safe = 12 then
      begin
        image( Auswahl1 ).top := ( 408 - 32 * s2a );
        image( Auswahl1 ).left := image( Auswahl1 ).left + 184;
        s1a := s1a - 1;
        s2a := s2a + 1;

      end;
    if ( start = 1 ) and ( ziel = 3 ) then
      safe := 13;
    if safe = 13 then
      begin
        image( Auswahl1 ).top := ( 408 - 32 * s3a );
        image( Auswahl1 ).left := image( Auswahl1 ).left + 368;
        s1a := s1a - 1;
        s3a := s3a + 1;

        if ( start = 2 ) and ( ziel = 3 ) then
          safe := 23;
        if safe = 23 then
          begin
            image( Auswahl2 ).top := ( 408 - 32 * s3a );
            image( Auswahl2 ).left := image( Auswahl2 ).left + 184;
            s2a := s2a - 1;
            s3a := s3a + 1;

            if ( start = 2 ) and ( ziel = 1 ) then
              safe := 21;
            if safe = 21 then
              begin
                image( Auswahl2 ).top := ( 408 - 32 * s1a );
                image( Auswahl2 ).left := image( Auswahl2 ).left - 184;
                s2a := s1a - 1;
                s1a := s1a + 1;

                if ( start = 3 ) and ( ziel = 1 ) then
                  safe := 31;
                if safe = 31 then
                  begin
                    image( Auswahl ).top := ( 408 - 32 * s1a );
                    image( Auswahl ).left := image( Auswahl ).left - 368;
                    s3a := s3a - 1;
                    s1a := s1a + 1;

                    if ( start = 3 ) and ( ziel = 2 ) then
                      safe := 32;
                    if safe = 32 then
                      begin
                        image( Auswah )l.top := ( 408 - 32 * s1a );
                        image( Auswahl ).left := image( Auswahl ).left - 184;
                        s3a := s3a - 1;
                        s2a := s2a + 1;
                      end;
Kaum macht man's richtig - schon funktioniert's
Zertifikat: Sir Rufo (Fingerprint: ‎ea 0a 4c 14 0d b6 3a a4 c1 c5 b9 dc 90 9d f0 e9 de 13 da 60)
  Mit Zitat antworten Zitat