Initial Commit

This commit is contained in:
Ulf Gebhardt 2018-02-15 22:43:20 +01:00
parent c043224aec
commit cdcfcdd355
6 changed files with 301 additions and 0 deletions

35
Pixelbalttle.cfg Normal file
View File

@ -0,0 +1,35 @@
-$A8
-$B-
-$C+
-$D+
-$E-
-$F-
-$G+
-$H+
-$I+
-$J-
-$K-
-$L+
-$M-
-$N+
-$O+
-$P+
-$Q-
-$R-
-$S-
-$T-
-$U-
-$V+
-$W-
-$X+
-$YD
-$Z1
-cg
-AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
-H+
-W+
-M
-$M16384,1048576
-K$00400000
-LE"c:\programme\delphi\Projects\Bpl"
-LN"c:\programme\delphi\Projects\Bpl"

83
Pixelbalttle.dof Normal file
View File

@ -0,0 +1,83 @@
[FileVersion]
Version=6.0
[Compiler]
A=8
B=0
C=1
D=1
E=0
F=0
G=1
H=1
I=1
J=0
K=0
L=1
M=0
N=1
O=1
P=1
Q=0
R=0
S=0
T=0
U=0
V=1
W=0
X=1
Y=1
Z=1
ShowHints=1
ShowWarnings=1
UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
[Linker]
MapFile=0
OutputObjs=0
ConsoleApp=1
DebugInfo=0
RemoteSymbols=0
MinStackSize=16384
MaxStackSize=1048576
ImageBase=4194304
ExeDescription=
[Directories]
OutputDir=
UnitOutputDir=
PackageDLLOutputDir=
PackageDCPOutputDir=
SearchPath=
Packages=vcl;rtl;vclx;VclSmp;vclshlctrls;fileinfo;gif;Indy60;semipanel;Zip;Simons;ztreeviewpack;trayico;Transbutton
Conditionals=
DebugSourceDirs=
UsePackages=0
[Parameters]
RunParams=
HostApplication=
Launcher=
UseLauncher=0
DebugCWD=
[Version Info]
IncludeVerInfo=1
AutoIncBuild=0
MajorVer=1
MinorVer=0
Release=0
Build=0
Debug=0
PreRelease=0
Special=0
Private=0
DLL=0
Locale=1031
CodePage=1252
[Version Info Keys]
CompanyName=Yeminy
FileVersion=0.002
LegalCopyright=(c) by Yeminy
ProductVersion=0.002

13
Pixelbalttle.dpr Normal file
View File

@ -0,0 +1,13 @@
program Pixelbalttle;
uses
Forms,
uPixelbattle in 'uPixelbattle.pas' {Form1};
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.

BIN
Pixelbalttle.res Normal file

Binary file not shown.

28
uPixelbattle.dfm Normal file
View File

@ -0,0 +1,28 @@
object Form1: TForm1
Left = 213
Top = 145
Width = 870
Height = 601
Caption = 'Form1'
Color = clSilver
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
OnCreate = FormCreate
PixelsPerInch = 96
TextHeight = 13
object Timer1: TTimer
Interval = 1
OnTimer = Timer1Timer
Left = 120
Top = 40
end
object Timer2: TTimer
Interval = 1
Left = 152
Top = 40
end
end

142
uPixelbattle.pas Normal file
View File

@ -0,0 +1,142 @@
unit uPixelbattle;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls;
type
TForm1 = class(TForm)
Timer1: TTimer;
Timer2: TTimer;
procedure FormCreate(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure pixelred;
procedure pixelblue;
procedure pixelrandom;
private
{ Private declarations }
public
{ Public declarations }
blue,red,tred,tblue:integer;
allfarben:boolean;
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
randomize;
if messagedlg('Alle Farben?',mtwarning,[mbok,mbno],0)=mrok then allfarben:=true else allfarben:=false;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
var i:integer;
begin
if allfarben then
begin
for I:=0 to 10000 do pixelrandom;
end else
begin
for i:=0 to 10000 do
begin
pixelred;
pixelblue;
form1.caption:= 'Red= '+inttostr(red)+'/'+inttostr(tred)+'; blue= '+inttostr(blue)+'/'+inttostr(tblue);
end;
if red+blue >= 490000 then
begin
timer1.Enabled:=false;
if blue-red>0 then showmessage('blue WINS!');
if blue-red<0 then showmessage('Red WINS!');
if blue-red=0 then showmessage('DRAW!');
end;
end;
end;
procedure TForm1.pixelrandom;
var i,j,c:integer;
tempcolor,tempcolor2:TColor;
begin
i:=random(form1.Width);
j:=random(form1.Height);
tempcolor:=canvas.Pixels[i,j];
inc(tred);
if tempcolor=clsilver then
begin
c:=random(14);
if c=0 then tempcolor2:=clblack;
if c=1 then tempcolor2:=clred;
if c=2 then tempcolor2:=clgreen;
if c=3 then tempcolor2:=clwhite;
if c=4 then tempcolor2:=clblue;
if c=5 then tempcolor2:=clyellow;
if c=6 then tempcolor2:=clpurple;
if c=7 then tempcolor2:=clmaroon;
if c=8 then tempcolor2:=clnavy;
if c=9 then tempcolor2:=cllime;
if c=10 then tempcolor2:=clteal;
if c=11 then tempcolor2:=clfuchsia;
if c=12 then tempcolor2:=claqua;
if c=13 then tempcolor2:=clgray;
canvas.Pixels[i,j]:=tempcolor2;
end;
end;
procedure TForm1.pixelred;
var i,j:integer;
tempcolor:TColor;
begin
i:=random(form1.Width);
j:=random(form1.Height);
tempcolor:=canvas.Pixels[i,j];
inc(tred);
if tempcolor=clsilver then
begin
canvas.Pixels[i,j]:=clred;
inc(red);
end;
end;
procedure TForm1.pixelblue;
var i,j:integer;
tempcolor:TColor;
begin
i:=random(form1.Width);
j:=random(form1.Height);
tempcolor:=canvas.Pixels[i,j];
inc(tblue);
if tempcolor=clsilver then
begin
canvas.Pixels[i,j]:=clblue;
inc(blue);
end;
end;
end.