unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Buttons, ExtCtrls; type TForm1 = class(TForm) Panel1: TPanel; BitBtn1: TBitBtn; StaticText1: TStaticText; Label1: TLabel; BitBtn2: TBitBtn; BitBtn3: TBitBtn; Label2: TLabel; StaticText2: TStaticText; Label3: TLabel; procedure FormCreate(Sender: TObject); procedure BitBtn1Click(Sender: TObject); procedure BitBtn2Click(Sender: TObject); private { Private-Deklarationen } public { Public-Deklarationen } end; var Form1: TForm1; gesamt:byte; implementation {$R *.dfm} procedure TForm1.FormCreate(Sender: TObject); begin randomize; end; procedure TForm1.BitBtn1Click(Sender: TObject); var current_dice:byte; begin current_dice:=random(5)+1; Label1.Caption:=IntToStr(current_dice); gesamt:=gesamt+current_dice; Label3.Caption:=IntToStr(gesamt); if (gesamt>15)and(gesamt<=19) then begin Label2.Caption:='ACHTUNG - das kann schon schief gehen!'; Label2.Font.Color:=clOlive; end; if (gesamt>19)and(gesamt<21) then begin Label2.Caption:='ACHTUNG - hör'' lieber auf!'; Label2.Font.Color:=clPurple; end; if gesamt>21 then begin BitBtn1.Enabled:=false; Label2.Caption:='Schade - Du hast Dich überschätzt!'; Label2.Font.Color:=clRed; end; end; procedure TForm1.BitBtn2Click(Sender: TObject); begin gesamt:=0; Label1.Caption:='?'; Label3.Caption:='?'; BitBtn1.Enabled:=true; Label2.Caption:='Du kannst unbedenklich würfeln!'; Label2.Font.Color:=clGreen; end; end.