unit Unit1;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
  StdCtrls;

type

  { TForm1 }

  TForm1 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    Image1: TImage;
    Image2: TImage;
    Label1: TLabel;
    Label2: TLabel;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private

  public

  end;

var
  Form1: TForm1;

implementation

{$R *.lfm}

{ TForm1 }

procedure TForm1.Button1Click(Sender: TObject);
  var Zahl1, Zahl2: Integer;
begin
    Randomize;
    Zahl1:= Random(6) + 1;
    Zahl2:= Random(6) + 1;
    // if Zahl = 1 then Image1.Picture.LoadFromFile('1.png');
    // if Zahl = 2 then Image1.Picture.LoadFromFile('2.png');
    // if Zahl = 3 then Image1.Picture.LoadFromFile('3.png');
    // if Zahl = 4 then Image1.Picture.LoadFromFile('4.png');
    // if Zahl = 5 then Image1.Picture.LoadFromFile('5.png');
    // if Zahl = 6 then Image1.Picture.LoadFromFile('6.png');
    case Zahl1 of
         1: Image1.Picture.LoadFromFile('1.png');
         2: Image1.Picture.LoadFromFile('2.png');
         3: Image1.Picture.LoadFromFile('3.png');
         4: Image1.Picture.LoadFromFile('4.png');
         5: Image1.Picture.LoadFromFile('5.png');
         6: Image1.Picture.LoadFromFile('6.png');
    end;
    case Zahl2 of
         1: Image2.Picture.LoadFromFile('1.png');
         2: Image2.Picture.LoadFromFile('2.png');
         3: Image2.Picture.LoadFromFile('3.png');
         4: Image2.Picture.LoadFromFile('4.png');
         5: Image2.Picture.LoadFromFile('5.png');
         6: Image2.Picture.LoadFromFile('6.png');
    end;
    Label1.Caption:= 'Gesamtzahl der Augen: ' + IntToStr(Zahl1 + Zahl2);
    if Zahl1 = Zahl2 then Label2.Caption:= 'Pasch!' else  Label2.Caption:= '';
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  Application.Terminate;
end;

end.

