unit Unit8;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, ExtCtrls;
type
TForm8 =
class(TForm)
Panel1: TPanel;
Panel2: TPanel;
Panel3: TPanel;
Panel4: TPanel;
Panel5: TPanel;
Panel6: TPanel;
Panel7: TPanel;
Panel8: TPanel;
Panel9: TPanel;
Panel10: TPanel;
BitBtn1: TBitBtn;
Label1: TLabel;
Panel11: TPanel;
Panel12: TPanel;
procedure BitBtn1Click(Sender: TObject);
procedure Panel2Click(Sender: TObject);
procedure Panel3Click(Sender: TObject);
procedure Panel4Click(Sender: TObject);
procedure Panel5Click(Sender: TObject);
procedure Panel6Click(Sender: TObject);
procedure Panel7Click(Sender: TObject);
procedure Panel8Click(Sender: TObject);
procedure Panel9Click(Sender: TObject);
procedure Panel10Click(Sender: TObject);
procedure Gewinner;
procedure FormCreate(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Spieler:
string;
{Spieler2: String;}
a:
string;
b:
string;
Panel2G :
string;
Panel3G :
string;
Panel4G :
string;
Panel5G :
string;
Panel6G :
string;
Panel7G :
string;
Panel8G :
string;
Panel9G :
string;
Panel10G:
string;
Panel11 :
string;
Form8: TForm8;
implementation
{$R *.dfm}
procedure TForm8.FormCreate(Sender: TObject);
begin
Panel2.Caption := '
';
Panel3.Caption := '
';
Panel4.Caption := '
';
Panel5.Caption := '
';
Panel6.Caption := '
';
Panel7.Caption := '
';
Panel8.Caption := '
';
Panel8.Caption := '
';
Panel9.Caption := '
';
Panel10.Caption := '
';
Panel11.Caption :='
';
Panel12.Caption :='
';
end;
procedure TForm8.BitBtn1Click(Sender: TObject);
begin
Panel2.Caption := '
';
Panel3.Caption := '
';
Panel4.Caption := '
';
Panel5.Caption := '
';
Panel6.Caption := '
';
Panel7.Caption := '
';
Panel8.Caption := '
';
Panel8.Caption := '
';
Panel9.Caption := '
';
Panel10.Caption := '
';
Panel11.Caption :='
';
Panel12.Caption :='
';
{Panel2G:= a;
Panel3G:= a;
Panel4G:= a;
Panel5G:= a;
Panel6G:= a;
Panel7G:= a;
Panel8G:= a;
Panel9G:= a;
Panel10G:= a;}
Spieler:=a;
end;
procedure TForm8.Gewinner;
begin
if
(((panel2G=a)
and (panel5G=a))
and (panel8G=a))
then
Form8.Panel11.Caption := '
Spieler 1';
if
(((panel2G=a)
and (panel3G=a))
and (panel4G=a))
then
Form8.Panel11.Caption := '
Spieler 1';
if
(((panel2G=a)
and (panel6G=a))
and (panel10G=a))
then
Form8.Panel11.Caption := '
Spieler 1';
if
(((panel3G=a)
and (panel6G=a))
and (panel9G=a))
then
Form8.Panel11.Caption := '
Spieler 1';
if
(((panel4G=a)
and (panel7G=a))
and (panel10G=a))
then
Form8.Panel11.Caption := '
Spieler 1';
if
(((panel4G=a)
and (panel6G=a))
and (panel8G=a))
then
Form8.Panel11.Caption := '
Spieler 1';
if
(((panel5G=a)
and (panel6G=a))
and (panel7G=a))
then
Form8.Panel11.Caption := '
Spieler 1';
if
(((panel8G=a)
and (panel9G=a))
and (panel10G=a))
then
Form8.Panel11.Caption := '
Spieler 1';
{--------------------------------------------------------}
if
(((panel2G=b)
and (panel5G=b))
and (panel8G=b))
then
Form8.Panel12.Caption := '
Spieler 2';
if
(((panel2G=b)
and (panel3G=b))
and (panel4G=b))
then
Form8.Panel12.Caption := '
Spieler 2';
if
(((panel2G=b)
and (panel6G=b))
and (panel10G=b))
then
Form8.Panel12.Caption := '
Spieler 2';
if
(((panel3G=b)
and (panel6G=b))
and (panel9G=b))
then
Form8.Panel12.Caption := '
Spieler 2';
if
(((panel4G=b)
and (panel7G=b))
and (panel10G=b))
then
Form8.Panel11.Caption := '
Spieler 2';
if
(((panel4G=b)
and (panel6G=b))
and (panel8G=b))
then
Form8.Panel12.Caption := '
Spieler 2';
if
(((panel5G=b)
and (panel6G=b))
and (panel7G=b))
then
Form8.Panel12.Caption := '
Spieler 2';
if
(((panel8G=b)
and (panel9G=b))
and (panel10G=b))
then
Form8.Panel12.Caption := '
Spieler 2';
end;
procedure TForm8.Panel2Click(Sender: TObject);
begin
if (Spieler=a)
then
begin
Panel2.Caption:='
O';
Panel2G:= a;
Spieler:= b;
end;
if(Spieler=b)
then
begin
Panel2.Caption:='
X';
Panel2G:= b;
Spieler:= a;
end;
Gewinner;
end;
procedure TForm8.Panel3Click(Sender: TObject);
begin
if(Spieler=a)
then
begin
Panel3.Caption:='
O';
Panel3G:= a;
Spieler:= b;
end;
if (Spieler=b)
then
begin
Panel3.Caption:='
X';
Panel3G:=b;
Spieler:=a;
end;
Gewinner;
end;
procedure TForm8.Panel4Click(Sender: TObject);
begin
if(Spieler=a)
then
begin
Panel4.Caption:='
O';
Panel4G:= a;
Spieler:= b;
end;
if (Spieler=b)
then
begin
Panel4.Caption:='
X';
Panel4G:=b;
Spieler:=a;
end;
Gewinner;
end;
procedure TForm8.Panel5Click(Sender: TObject);
begin
if(Spieler=a)
then
begin
Panel5.Caption:='
O';
Panel5G:= a;
Spieler:= b;
end;
if (Spieler=b)
then
begin
Panel5.Caption:='
X';
Panel5G:=b;
Spieler:=a;
end;
Gewinner;
end;
procedure TForm8.Panel6Click(Sender: TObject);
begin
if(Spieler=a)
then
begin
Panel6.Caption:='
O';
Panel6G:= a;
Spieler:= b;
end;
if (Spieler=b)
then
begin
Panel6.Caption:='
X';
Panel6G:=b;
Spieler:=a;
end;
Gewinner;
end;
procedure TForm8.Panel7Click(Sender: TObject);
begin
if(Spieler=a)
then
begin
Panel7.Caption:='
O';
Panel7G:= a;
Spieler:= b;
end;
if (Spieler=b)
then
begin
Panel7.Caption:='
X';
Panel7G:=b;
Spieler:=a;
end;
Gewinner;
end;
procedure TForm8.Panel8Click(Sender: TObject);
begin
if(Spieler=a)
then
begin
Panel8.Caption:='
O';
Panel8G:= a;
Spieler:= b;
end;
if (Spieler=b)
then
begin
Panel8.Caption:='
X';
Panel8G:=b;
Spieler:=a;
end;
Gewinner;
end;
procedure TForm8.Panel9Click(Sender: TObject);
begin
if(Spieler=a)
then
begin
Panel9.Caption:='
O';
Panel9G:= a;
Spieler:= b;
end;
if (Spieler=b)
then
begin
Panel9.Caption:='
X';
Panel9G:=b;
Spieler:=a;
end;
Gewinner;
end;
procedure TForm8.Panel10Click(Sender: TObject);
begin
if(Spieler=a)
then
begin
Panel10.Caption:='
O';
Panel10G:= a;
Spieler:= b;
end;
if (Spieler=b)
then
begin
Panel10.Caption:='
X';
Panel10G:=b;
Spieler:=a;
end;
Gewinner;
end;
end.