Einzelnen Beitrag anzeigen

keikedeike

Registriert seit: 6. Jun 2011
9 Beiträge
 
#9

AW: Mein Schulprojekt Yahtzee V 1.0

  Alt 19. Jun 2011, 15:51
Hier der Knopf für die Kleine Strasse!


Delphi-Quellcode:
procedure Tfyahtzee.btnkleinClick(Sender: TObject);
      var i,j,k,l,m,n,comp,comp1,comp2:integer;
    str:string;

begin
       if (lbl1.caption = '-1')then
                      begin
                         btnklein.enabled := true;
                         showmessage('Es wurde schon ein Feld ausgewählt');
                      end;

   str:=lbl1.caption+lbl2.caption+lbl3.caption+lbl4.caption+lbl5.caption;

comp:=1;
for j:=1 to 4 do
begin
for i:=0 to 4 do
begin
  if (str[i])= inttostr(j) then comp:=comp+1;
end;
end;


comp1:=1;
for k:=2 to 5 do
begin
for l:=0 to 4 do
begin
  if (str[l])= inttostr(k) then comp1:=(comp1)+1;
end;
end;

comp2:=1;
for m:=3 to 6 do
   begin
      for n:=0 to 4 do
         begin
             if (str[n])= inttostr(m) then comp2:=(comp2)+1;
   end;
         end;

if (comp1=4) or (comp2=4) then
begin
   lblkleinestrasse.caption:='30';
   btnklein.enabled:=false;
   lblN.caption := '0';
   cb1.Checked := false;
   cb2.Checked := false;
   cb3.Checked := false;
   cb4.Checked := false;
   cb5.Checked := false;
   btnbegin.enabled := true ;
   cb1.enabled:= false;
   cb2.enabled:= false;
   cb3.enabled:= false;
   cb4.enabled:= false;
   cb5.enabled:= false;

end
else
  begin
     btnklein.enabled := false;
     lblN.caption := '0';
     cb1.Checked := false;
     cb2.Checked := false;
     cb3.Checked := false;
     cb4.Checked := false;
     cb5.Checked := false;
     btnbegin.enabled := true ;
    cb1.enabled:= false;
    cb2.enabled:= false;
    cb3.enabled:= false;
    cb4.enabled:= false;
    cb5.enabled:= false;
  end;
                      lbl1.caption := '-1';
                      lbl2.caption := '0';
                      lbl3.caption := '0';
                      lbl4.caption := '0';
                      lbl5.caption := '0';

end;

Hier Knopf Grosse Strasse

Delphi-Quellcode:
   procedure Tfyahtzee.btngrossClick(Sender: TObject);
    var i,a,b,c,d,e :integer;

begin
    a := strtoint(lbl1.caption);
    b := strtoint(lbl2.caption);
    c := strtoint(lbl3.caption);
    d := strtoint(lbl4.caption);
    e := strtoint(lbl5.caption);
    i := 1;
    i := i+1;
    if (lbl1.caption = '-1')then
       begin
          btngross.enabled := true;
          showmessage('Es wurde schon ein Feld ausgewählt');
       end;

    for i := 1 to 4 do
      begin
          if (a=i )or (b=i )or (c=i )or(d=i )or (e=i )then
             begin

                if(a=i+1 )or(b=i+1 )or(c=i+1 )or(d=i+1 )or(e=i+1 )then
                    begin

                      if(a=i+2 )or(b=i+2 )or(c=i+2 )or(d=i+2 )or(e=i+2 )then
                         begin

                           if(a=i+3 )or(b=i+3 )or(c=i+3 )or(d=i+3 )or(e=i+3 )then
                              begin
                                 if(a=i+4 )or(b=i+4 )or(c=i+4 )or(d=i+4 )or(e=i+4 )then
                                 begin
                                   lblgross.caption := '40';
                                   btngross.Enabled := false ;
                                   cb1.checked:=false;
                                   cb2.checked :=false;
                                   cb3.checked:=false;
                                   cb4.checked :=false;
                                   cb5.checked:=false;
                                   cb1.enabled:= false;
                                   cb2.enabled:= false;
                                   cb3.enabled:= false;
                                   cb4.enabled:= false;
                                   cb5.enabled:= false;
                                   btnbegin.enabled := true;
                                   lblN.caption := '0';
                                 end;


                        end;

                        end;

                        end;
                         end
                         else
                                 lblgross.caption := '0';
                                 btngross.enabled:=false;
                                  cb1.checked:=false;
                                   cb2.checked :=false;
                                   cb3.checked:=false;
                                   cb4.checked :=false;
                                   cb5.checked:=false;
                                   cb1.enabled:= false;
                                   cb2.enabled:= false;
                                   cb3.enabled:= false;
                                   cb4.enabled:= false;
                                   cb5.enabled:= false;
                                   btnbegin.enabled := true;
                                   lblN.caption := '0';
                              end;

                                      lbl1.caption := '-1';
                                      lbl2.caption := '0';
                                      lbl3.caption := '0';
                                      lbl4.caption := '0';
                                      lbl5.caption := '0';
  end;
  Mit Zitat antworten Zitat