Einzelnen Beitrag anzeigen

biby90
(Gast)

n/a Beiträge
 
#79

AW: tic tac toe.... mal wieder:) versteh aufgabestellung nicht ganz

  Alt 23. Aug 2011, 16:08
Delphi-Quellcode:
function TForm1.CheckForWin(AIndex: array of string): Boolean;
begin
  AIndex[1]:= Label1.Caption;
  AIndex[2]:= Label2.Caption;
  AIndex[3]:= Label3.Caption;
  AIndex[4]:= Label4.Caption;
  AIndex[5]:= Label5.Caption;
  AIndex[6]:= Label6.Caption;
  AIndex[7]:= Label7.Caption;
  AIndex[8]:= Label8.Caption;
  AIndex[9]:= Label9.Caption;

  result := false;
  begin
    if (AIndex[1] = AIndex[2]) and (AIndex[2] = AIndex[3]) and
      (IsFieldEmpty(AIndex[1]) = false) then
    begin
      result := true;
    end;
    if (AIndex[4] = AIndex[5]) and (AIndex[5] = AIndex[6]) and
      (IsFieldEmpty(AIndex[4]) = false) then
    begin
      result := true;
    end;
    if (AIndex[7] = AIndex[8]) and (AIndex[8] = AIndex[9]) and
      (IsFieldEmpty(AIndex[7]) = false) then
    begin
      result := true;
    end;
    if (AIndex[1] = AIndex[4]) and (AIndex[4] = AIndex[7]) and
      (IsFieldEmpty(AIndex[1]) = false) then
    begin
      result := true;
    end;
    if (AIndex[2] = AIndex[5]) and (AIndex[5] = AIndex[8]) and
      (IsFieldEmpty(AIndex[2]) = false) then
    begin
      result := true;
    end;
    if (AIndex[3] = AIndex[6]) and (AIndex[6] = AIndex[9]) and
      (IsFieldEmpty(AIndex[3]) = false) then
    begin
      result := true;
    end;
    if (AIndex[1] = AIndex[5]) and (AIndex[5] = AIndex[9]) and
      (IsFieldEmpty(AIndex[1]) = false) then
    begin
      result := true;
    end;
    if (AIndex[3] = AIndex[5]) and (AIndex[5] = AIndex[7]) and
      (IsFieldEmpty(AIndex[3]) = false) then
    begin
      result := true;
    end;
  end;
end;
aber wieso geht der denn nicht?