Thema: Delphi Syntax Optimierbar?

Einzelnen Beitrag anzeigen

quendolineDD

Registriert seit: 19. Apr 2007
Ort: Dresden
781 Beiträge
 
Turbo Delphi für Win32
 
#1

Syntax Optimierbar?

  Alt 16. Okt 2007, 22:46
Hallo, ist die jetzige Syntax noch otpimierbar ohne irgendwelche Bewegungsabläufe zu unterschlagen?

Delphi-Quellcode:
//########################
//Bewegeungsabläufe
//X: -339 Y: -718 => Eingang

if (x = -339) and (y = -718) then
  if (exx = -338) and (exy = -719) then
    move('MoveDownLeft')
else
    move('MoveRight');

if (x = -338) and (y = -718) then
    move('MoveRight');

if (x = -337) and (y = -718) then
  if (exx = -336) and (exy = -719) then
    move('MoveUpLeft')
else
    move('MoveRight');

if (x = -336) and (y = -718) then
    move('MoveRight');

if (x = -335) and (y = -718) then
    move('MoveRight');

if (x = -334) and (y = -718) then
    move('MoveUpLeft');

if (x = -335) and (y = -719) then
    move('MoveUp');

if (x = -335) and (y = -720) then
    move('MoveDownLeft');

if (x = -336) and (y = -719) then
    move('MoveDownLeft');

if (x = -338) and (y = -719) then
    move('MoveDownLeft');

if (x = -340) and (y = -718) then
    move('MoveRight');

if (x = -340) and (y = -717) then
    move('MoveUp');
Ebenso würd ich gerne mal wissen, wenn die Procedure verlassen wird, ob dann die Werte x, y, exx und exy wieder aus dem Speicher gelöscht werden oder bleiben. Danke im Vorraus

Delphi-Quellcode:
lblPos.Caption := 'Position '+ pos_str;

delete(pos_str, 1, pos('X: ', pos_str)+2);
if x <> 0 then
  exx := x; //ex - X
x := strtoint(copy(pos_str, 0, pos('Y: ', pos_str)-2)); //x

delete(pos_str, 1, pos('Y: ', pos_str)+2);
if y <> 0 then
  exy := y; //ex - Y
y := strtoint(copy(pos_str, 0, length(pos_str))); //y
Lars S.
Wer nicht mit der Zeit geht, geht mit der Zeit.
  Mit Zitat antworten Zitat