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: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: 170: 171: 172: 173: 174: 175: 176: 177: 178: 179: 180: 181: 182: 183: 184: 185: 186: 187:
| unit Unit1;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls;
type TForm2 = class(TForm) Button2: TButton; Panel1: TPanel; Panel2: TPanel; Panel3: TPanel; Panel4: TPanel; Panel5: TPanel; Button1: TButton; Button3: TButton; Memo1: TMemo; procedure Button2Click(Sender: TObject); procedure FormActivate(Sender: TObject); procedure Panel1Click(Sender: TObject); procedure Panel2Click(Sender: TObject); procedure Panel3Click(Sender: TObject); procedure Panel4Click(Sender: TObject); procedure Panel5Click(Sender: TObject); procedure Button1Click(Sender: TObject); procedure Button3Click(Sender: TObject); private public end;
var Form2:TFOrm; ge,y:Array[1..5]of Integer; i,x,n,z,punkte,g1,g2:Integer; temp:string; w1,w2,w3,w4,w5,wx:boolean; implementation
{$R *.dfm}
procedure TForm2.Button2Click(Sender: TObject); begin
if x=3 then begin showmessage('Maximal 3 Würfe sind erlaubt!'); exit;end; Randomize; ge[1]:=0; ge[2]:=0; ge[3]:=0; ge[4]:=0; ge[5]:=0;
for i:=1 to n do begin ge[i]:=random(6)+1; end; if ge[1]>0 then Panel1.caption:=inttostr(ge[1]); if ge[2]>0 then Panel2.caption:=inttostr(ge[2]); if ge[3]>0 then Panel3.caption:=inttostr(ge[3]); if ge[4]>0 then Panel4.caption:=inttostr(ge[4]); if ge[5]>0 then Panel5.caption:=inttostr(ge[5]); x:=x+1; if w1=true then Panel1.caption:=inttostr(y[1]); if w2=true then Panel2.caption:=inttostr(y[2]); if w3=true then Panel3.caption:=inttostr(y[3]); if w4=true then Panel4.caption:=inttostr(y[4]); if w5=true then Panel5.caption:=inttostr(y[5]); end; procedure TForm2.FormActivate(Sender: TObject); begin n:=5; end;
procedure TForm2.Panel1Click(Sender: TObject); begin if w1=true then exit; y[1]:=strtoint(Panel1.caption); w1:=true; end;
procedure TForm2.Panel2Click(Sender: TObject); begin if w2=true then exit; y[2]:=strtoint(Panel2.caption); w2:=true; end;
procedure TForm2.Panel3Click(Sender: TObject); begin if w3=true then exit; y[3]:=strtoint(Panel3.caption); w3:=true; end;
procedure TForm2.Panel4Click(Sender: TObject); begin if w4=true then exit; y[4]:=strtoint(Panel4.caption); w4:=true; end;
procedure TForm2.Panel5Click(Sender: TObject); begin if w5=true then exit; y[5]:=strtoint(Panel5.caption); w5:=true; end;
procedure TForm2.Button1Click(Sender: TObject); BEGIN y[1]:=strtoint(panel1.caption); y[2]:=strtoint(panel2.caption); y[3]:=strtoint(panel3.caption); y[4]:=strtoint(panel4.caption); y[5]:=strtoint(panel5.caption);
end;
procedure TForm2.Button3Click(Sender: TObject); var i,j:integer; nw:array[1..6] of integer; Pasch2er,Pasch3er:integer; begin for i:=1 to 6 do nw[i]:=0; Pasch2er:=0; Pasch3er:=0;
y[1]:=strtoint(panel1.Caption); y[2]:=strtoint(panel2.Caption); y[3]:=strtoint(panel3.Caption); y[4]:=strtoint(panel4.Caption); y[5]:=strtoint(panel5.Caption);
memo1.Clear;
for i:=1 to 5 do begin if y[i]=1 then inc(nw[1],1); if y[i]=2 then inc(nw[2],1); if y[i]=3 then inc(nw[3],1); if y[i]=4 then inc(nw[4],1); if y[i]=5 then inc(nw[5],1); if y[i]=6 then inc(nw[6],1); end;
for i:=1 to 5 do memo1.Lines.Add(inttostr(y[i])+'/');
for i:=1 to 6 do begin if nw[i]=2 then begin Memo1.Lines.Add('Zweirpasch mit '+inttostr(i)); inc(Pasch2er,1); end; if nw[i]=3 then begin Memo1.Lines.Add('Dreierpasch mit '+inttostr(i)); inc(Pasch3er,1); end; if nw[i]=4 then Memo1.Lines.Add('Viererpasch mit '+inttostr(i)); if nw[i]=5 then Memo1.Lines.Add('Fünferpasch mit '+inttostr(i));
end;
if (Pasch2er=1) and (Pasch3er=1) then Memo1.Lines.Add('Full House'); end;
end. |