943,948 Members | Top Members by Rank

Ad:
Apr 24th, 2005
0

Need help programming a Delphi dice game

Expand Post »
Hi,

I need someone to help me create a program which will simulate the rolling of a die, counting how many of each die faces appear on the screen. This program should also explore the use of arrays.

Would appreitiate help greatly.

thank you,

Test
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
test is offline Offline
11 posts
since Dec 2002
Apr 24th, 2005
0

Re: Need help programming a Delphi dice game

so far i have,

procedure TDiceForm.resetClick(Sender: TObject);

begin
randomize;
for j := 1 to 6 do
numb [j] := 0;
Button11.Caption := '';
Button12.Caption := '';
Button13.Caption := '';
Button14.Caption := '';
Button15.Caption := '';
Button16.Caption := '';

end;

procedure TDiceForm.startstopClick(Sender: TObject);
begin
Timer1.Enabled := not Timer1.Enabled;
end;

procedure TDiceForm.Timer1Timer(Sender: TObject);

var die: integer;
begin
die := random(6) + 1; {random numbers of dice: 1-6}
DieImage.Picture.LoadFromFile(IntToStr(die) + '.bmp'); {convert die value to
string, add bitmap extension, load from file, and display as DieImage}
numb[die] := numb[die] + 1;
case die of
1:CountOneButton.Caption := IntToStr(numb[die]);
2:CountTwoButton.Caption := IntToStr(numb[die]);
3:CountThreeButton.Caption := IntToStr(numb[die]);
4:CountFourButton.Caption := IntToStr(numb[die]);
5:CountFiveButton.Caption := IntToStr(numb[die]);
6:CountSixButton.Caption := IntToStr(numb[die]);

end;
Reputation Points: 10
Solved Threads: 0
Newbie Poster
test is offline Offline
11 posts
since Dec 2002

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Pascal and Delphi Forum Timeline: Returning from a sleep screen using Delphi
Next Thread in Pascal and Delphi Forum Timeline: Sound and Graphics?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC