procedure TForm1.Button5Click(Sender: TObject);
var Elo1,Elo2,z,Einsatz,i,p: integer;
EA,Potenz,Pot,Quote1,Quote2,Bilanz,Gewinn: real;
begin
Elo1:=strtoint(Form1.Edit1.Text);
Elo2:=strtoint(Form1.Edit2.Text);
IF Elo1 > Elo2 then
begin
IF Elo1-Elo2>400 then
begin
Pot:=1;
end
else if Elo1-Elo2<400 then
begin
Pot:=(Elo1-Elo2)/400;
end
end
else IF Elo1<Elo2 then
begin
IF Elo2-Elo1>400 then
begin
Pot:=1;
end
else IF Elo2-Elo1<400 then
begin
Pot:=(Elo2-Elo1)/400;
end
else IF Elo1=Elo2 then
begin
Pot:=1;
end
end;
Potenz := Power(10, Pot);
EA:=1/ (1 + Potenz);
IF Elo1>Elo2 then
begin
Quote1:=(1/((1-EA)100)100)*0.9;
Quote2:=(1/(EA100)100)*0.9;
end
else if Elo1<Elo2 then
begin
Quote1:=(1/(EA100)100)*0.9;
Quote2:=(1/((1-EA)100)100)*0.9;
end
else if Elo1=Elo2 then
begin
Quote1:=1.8;
Quote2:=1.8;
end;
z:=0;
z:=Random(100);
Einsatz:=strtoint(Form1.Edit5.Text);
IF Form1.ComboBox3.ItemIndex=0 then begin
IF z<(EA*100) then
begin
Form1.Label23.Font.Color:= clGreen;
Form1.Label23.Caption:=floattostrf(Quote1*Einsatz,fffixed,5,2)+' Euro gewonnen!';
Gewinn:=Quote1*Einsatz;
end
else if z>(EA*100) then
begin
Form1.Label23.Font.Color:= clRed;
Form1.Label23.Caption:=floattostrf(Einsatz,fffixed,5,2)+' Euro verloren!';
Gewinn:=-Einsatz;
end
end
else begin
IF z<(EA*100) then
begin
Form1.Label23.Font.Color:= clRed;
Form1.Label23.Caption:=floattostrf(Einsatz,fffixed,5,2)+' Euro verloren!';
Gewinn:=-Einsatz;
end
else if z>(EA*100) then
begin
Form1.Label23.Font.Color:= clGreen;
Form1.Label23.Caption:=floattostrf(Quote2*Einsatz,fffixed,5,2)+' Euro gewonnen!';
Gewinn:=Quote2*Einsatz;
end;
end;
Bilanz:=Bilanz+Gewinn;
Form1.Label17.Caption:=floattostrf(Bilanz,fffixed,5,2);
end;
Ich weiß nicht wieso hier die Hälfte automatisch als Zitat gesetzt wird. Bei jeden Click auf den Button wird die Variable Gewinn neu berechnet, und jedesmal wenn der Button gecklickt wird soll die Variable Bilanz aktuallisiert werden. Sie soll aus allen Bilanzen von vorher zusammen addiert bestehen.