5
2
This is similar to other hang-man style problems already posted, except, in this case, the computer is the one guessing. Computers are logical, smart, and consider self-preservation to be important, so there are a few RULES for how computers will guess.
The user will think of any word, that will be contained in the FULL Ispell word list. some of these may be upwards of 10-15 letters. The wordlist is simply the full ispell wordlist (english, and others, all combined), and may be placed in a folder with the program.
The computer will be given 8 lives. The computer will start by simply asking for an input of however many characters the word is. (example game below). After that, the computer will begin guessing, following the ruleset below!
- the computer will analyze all possible word outputs, and determine what letter guess has the most possible correct answers, and guess that letter. It will not duplicate any prior guesses.
- the computer will then ask for an updated word input, determine if it was correct at all, or wrong, and if wrong, will deduct 1 life.
Lastly, the computer will state the lives remaining.
EXAMPLE GAME User picks the word "Engineer" Computer asks for Letter count, User replies 8. Computer searches for most likely letter to be used in 8 letter words, determines it is letter H (not correct). Guesses H. User replies _ _ _ _ _ _ _ _ Computer outputs "7 lives remaining" and then picks the next most likely letter, an E User replies e _ _ _ _ e e _ computer outputs "7 lives remaining" and then recalculates based on its current knowledge what is the most likely next letter. Game continues until computer will state WIN, or LOSE.
SCORING: every program should follow the EXACT same method to arrive at the final answer. If yours follows the order of every other program, you receive -100 points. If yours is different (aka wrong), you receive 1000 points.
each byte of code is worth 1 point. a 30 letter code, is 30 points.
if your code manages to play each step of the game in less than 5 seconds, award yourself -100 points.
The winner will be chosen 1 week from the first answer, and a new question related to this one, will be asked. Obviously those with the best code here will have a head start on the new one!
EDIT: forgot to make note that as in golf, the lowest score wins.
Will there be no spaces in the input? – beary605 – 2012-07-24T04:46:20.957
4I'm tempted to post code which does something completely unrelated to the task, while there are no other answers (and my program therefore works exactly the same as all programs!). "Different" is a ridiculous definition of "wrong", in particular if you don't give any proper reference to what's right. – ceased to turn counterclockwis – 2012-07-24T07:10:28.397
@leftaroundabout the question states that the computer should guess the letter that has the "most possible correct answers" only in cases where multiple letter choices have exactly the same chance of being right should two programs ever differ. I don't know how often that will be though. – Matt – 2012-07-24T10:22:38.123
2ispell list contains a lot of words ending with <'s>. Would these be acceptable words, or can we clean the wordlist, excluding the above mentioned words? – milo5b – 2012-07-24T12:50:23.137
What if (assuming 4 answers) two people solve with method A and two with method B, does everyone get the +1000 penalty? – Gaffi – 2012-07-24T14:51:18.690
Also running time and "game steps" have a definition a bit too loose: running time on what machine? Is the time taken to ask the first input (word's length) considered as a step or could it take as long as needed and still be eligible for the 100 points deduction (as long as the other steps are completed in the 5 secs timeframe)? – milo5b – 2012-07-24T14:58:34.070
Could we please have an example of expected output and input? (i.e. "7 lives remaining" or "7", "1 life remaining" or "1 lives remaining" is acceptable?) – milo5b – 2012-07-24T18:22:28.380
Please can we have some clarification on the format of output strings (if they are mandatory). Obviously people actually printing the word "guess" have a longer program than those who are not. – Leigh – 2012-07-26T06:32:46.267
Since alot of people decided to just use "guess" lets go ahead and make it the standard on this one. "X Lives Remaining" will be the other standard output string. and then either "WIN" or "LOSE" for the final output.
the 5 second rule just simply assumes that once given input, it completes that step of the process within 5 seconds on a reasonable machine (will be tested on an i7 930 2.9mhz 4xcore)
tiebreaks for the program in case of the same counts, simply have your program pick the one with the most possible words matching that guess, if still a tie, pick the one alphabetically first. – NRGdallas – 2012-07-27T17:01:06.780
This contest will end in 1 week. August 3rd, at noon, CST.
at that time, the next step of the contest will be posted. – NRGdallas – 2012-07-27T17:07:51.390
one other issue I am seeing, after an incorrect guess, your program should recount, removing all words with that letter from the calculations. a good example of where this would CHANGE the guesses would be a list of words such as (good, google, open, amp, ant) its first guess would be "o"(3 values), if incorrect, it should remove good, google, and open from the wordlist it is considering, resulting in the next guess of "a" - ant, amp, NOT a guess of g. – NRGdallas – 2012-07-27T17:19:29.440
also, you should NOT prompt for the correct word before beginning. only the number of letters, and then the result after each word. – NRGdallas – 2012-07-27T17:21:03.260
regarding tiebreaks, the above statement "tiebreaks for the program in case of the same counts, simply have your program pick the one with the most possible words matching that guess, if still a tie, pick the one alphabetically first." - can simply be read as "alphabetically first", as the first tiebreak is kinda the point of the program... Don't ask where I got it from >.>
in addition; words from the wordlist can assume to not include any symbols such as apostrophes etc, and it can be assumed that a word will be chosen from the list. – NRGdallas – 2012-07-27T18:17:36.467