WANTED:: Homework HELP

Status
Not open for further replies.

sword

Solid State Member
Messages
6
:rolleyes: I have a terrible homework to do. I am thinking about it but there is no result for several days. I explain .. There is a txt file, and it contains about 30.000 words, like a dictionary. The aim of the game is to find the word which is kept by computer selected from dictionary. Here is an example:
for example computer kept "printer" word and now i guess "apple" then computer writes "3" because "2p" and "e" is included. And i guess "present" comp. writes 5 because "p","r","e","e","t" like that.And i say these letters may be included. But if the word kept by comp. include repetition letter, game become a bit complicated. For example
kept guess result
--------- ------- ------------
"soccer" "accrue" 6 (4 from c + 1 from e + 1 from r)

and another example kept "qualification" and i guess "even" comp. writes "1" then i understand "e" is not there, "v" or "n" must be included.

..... finally the the word will appear after the elaminatings...
(like MASTER MIND game, but this about letters)

i am waiting for your helps friends :))) . I hope we find... (+sorry for bad english :p)
 
What language is this supposed to be written? I would think it would be pretty simple (in VB at least)... It's just a logic problem. Store the words in two separate arrays (one letter per array element), and match up each letter in one word to each letter in the other. If there's a letter match, then add one to the count.
 
y dont u just use the search for word thing that comes with word or notepad or something along those lines you should be able to find what u are looking for then. I hope i was usefull and good luck with it.
 
HardKore{Killa} said:
y dont u just use the search for word thing that comes with word or notepad or something along those lines you should be able to find what u are looking for then. I hope i was usefull and good luck with it.

I think he's supposed to write a program that does it. :freak:
 
hello again :) the main opinion is find the all lletters included in the kept word, and MINIMUM STEP is the most important thing. Otherwise everyone finds the word with compairing with all words. minimum step and time is very important. I have been using Borland C++ Builder to solve it. In fact the game contain three part, human-comp , comp- human, comp-comp.
C++ or C codes will be useful for me ...

i hope this will be solved... :) THANKS again....
 
I'm just starting out with C++, so about the most I can do is print "Hello world" in a console. But do you have a function that would allow you to take a word and put all the letters in the word into an array?
 
what you can do is liek they said, store the word in an array as such

char word[]={'a','p','p','l','e');

where each lettter corresponds to an index (0-4 in this case). then you take the word that's input and you store it in an array. it's been a while but i think you do it like this:
at top of code:

char inword[], c;
int i;

and then at the appropriate place:

cout << "Enter a word: ";
while ((c=getchar()) != '\n')
inword[i++]=c;
inword[i++]='\0';


after that, you take each letter from one word and compare it with all the letters on the other word in a nested for loop. if they match, add 1 to a counter or to the score for that matter. if not, keep looping until verything has been compared.

good luck!
 
Thanx friends but i already have a function which compares and stores the letters' count. The problem is algorithm. :) Do you know Master Mind. I want to find the algorithm or code like master mind game playing with letters. The problem is that. When i keep a word on my mind, computer must find it within aproximately 7-8 steps, eleminating the letters, comp must find all letters in the kept word, not directly the kept word...

thanx for your help..
 
Oooh, so the computer has to guess the word that the human is thinking of.

I'm officially stumped. The only thing I can think of is this:

1.) Say the human is thinking of "apple", and the computer picks a word at random - for example, "orange."

2.) The human then tells the computer that the correct letters are A and E.

3.) The computer searches the dictionary for any word that has A and E but not O, R, N, or G.

4.) The computer guesses the first word it comes to that meets the criteria - let's say "ape."

5.) The human tells the computer that the correct letters are "a", "p", and "e".

6.) The computer searches the dictionary for any word that has A, P, and E, but not O, R, N, or G.

7.) And so on...

I don't know if that's helpful or not, but it's the only way I can think of. :confused:

EDIT: Never mind, I just re-read your first post and I forgot that you don't know which letters are right, you just know how many of them are right. Hmm... this is a hard one, I'm going to have to think about it a little more.
 
thanks for your answers, but the trouble is different. Anyway unfortunately i have only 3-4 days to deliver the project. It looks like impossible. I am thinking but there is no definite result.
:( I hope i or one of you will manage to solve this...
thanx again...
 
Status
Not open for further replies.
Back
Top Bottom