0

hi im doing a hangman game on delphi and need to randomly choose a word from an array then every letter guessed by the user for the game to check if the letter is in the word n if so place it in the appropriate place and if not build a part of the gallows.. this is wat i have so far:

var NumberOfErrors, NumberOfLetters, NumberFound, time, count, setLength: integer;
ComputerWord, usersword: string;
found: boolean;

Randomize;
ComputerWord:= (Easywords);
NumberOfLetters:= length (ComputerWord);
setLength:= (usersword) NumberOFLetters);
WordLbl.Caption:= '';
NumberFound:= 0;
NumberOfErrors:= 0;
for count:= 1 to NumberOfLetters do
if ComputerWord [count] = key then
Begin
found:= true;
usersword [count] := key;
end;

procedure CheckIfCharacterInComputerWord (Sender: TObject);
Begin
NumberFound:= 0;
for count:= 1 to NumberOfLetters do
if Usersword [count] = key then
Begin
found:= true;
usersword:= key;
end;

procedure CountNumberFound (Sender:TObject);
Begin
NumberFound:= 0;
for count:= NumberOfLetters do
if Usersword [count] <> '?'
then NumberFound:= NumberFound + 1;
end;

Begin
wordLbl.caption:= '';
for count:= 1 to length (usersword) do
wordLbl.caption:= WordLbl.caption + Usersword [count] + '';
end;

Begin
NumberOfErrors:= NumberOFErrors + 1;
ImageHangman.Picture.LoadFromFile ('ImageEasy' + IntToStr (NumberOfErrors) + '.bmp');

2
Contributors
2
Replies
3
Views
10 Years
Discussion Span
Last Post by sez90
0

ahh it doesnt work, y would i post a question if it all worked?

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.