OMG NEED HELP FOR TURING BAD

Computer builds, hardware and software discussion or troubleshooting, including peripherals. Essentially a general place to talk about desktop computers.
Locked
Anonymous

OMG NEED HELP FOR TURING BAD

Post by Anonymous »

:banghead: :banghead: :banghead: i am still working on the what is the word coding, however i seem to be missing something within my coding, because when i put in a guess this occurs :banghead:

word: iceteks

"waht is your guess?"
i
i*****"what is your guess?"
c
*c*****"what is your guess?"

so on and so forth. anyhow this is my coding, i hope taht you can help me with this




intlengthfound := length(strfound)
for i:1..intLengthOfPuzzle
for j:1..intlengthfound
if (strGame(i) = strfound(j)) then

intMatch := 1

put strGame(i)..
else
put "*"..

end if
end for
end for

put ""

intMatch := 0
end loop

Archived topic from Iceteks, old topic ID:2923, old post ID:23828
User avatar
Death
Posts: 7919
Joined: Thu Sep 30, 2004 10:12 pm

OMG NEED HELP FOR TURING BAD

Post by Death »

Okay, for turing posts, please include your variables. It's hard to tell how a program works without knowing the variables (and procedures by the way). From the looks of it, you're repeating the process of the blanks for no reason. When you guess a letter, it goes through your process and outputs *c*****. Now, what you're doing, is RE-DOING the process, so when you're placing your asterisks, you're not taking into account that there's already a letter there. What you need is some kiind of conditional statement that checks to see if the LETTER in LENGTH of STRING was chosen. What you need to do is check to see if the letter was chosen. This can be done by varifying if the letter in your word is an asterisk or not. I would create a variable that stores how many characters your word is, and converts it to asterisks. So if the word is ICETEKS, there are 7 letters, so the new variable would be like this:

NOTE: "You'll need to figure out how to get it so that the variable can store whatever length of asterisks that are needed":

blanks := "*******"

So, in your conditional statement, you'll just need to check to see if the LETTER'S space in BLANK is taken. Here's what I mean:

for i: 1..LENGTH OF YOUR WORD
if LETTER = STRING IN THIS POSITION OF YOUR WORD (i) then
blank (POSITION OF I) := LETTER
end if
end for

so basically, this program will TAKE the letter you chose, find in the WORD where the letter belongs (EX: in ICETEKS, C is the second letter). Then, if there's a match, the position in the variable BLANK is changed to THAT letter (So in blank *******, the second letter will become a C.) In doing this, there's no way that the variable BLANK will be erased and seeing as the letters are stored in a variable, they cannot be erased. Hopefully this helps you out.

Archived topic from Iceteks, old topic ID:2923, old post ID:23832
Anonymous

OMG NEED HELP FOR TURING BAD

Post by Anonymous »

why dont you post the question too that might help, are you trying to get the people to guess a letter, kinda like hangman? i have no idea what you want lol so post the whole thing and i'll be able to help better

Archived topic from Iceteks, old topic ID:2923, old post ID:23899
Locked