[personal profile] mattlistener
I can't sleep, because my mind has latched onto a very big project that I need to write out. This cup may pass, but at the moment I'm inspired to write a Jotto-playing perl program with a better AI than any I've found on the net, so I'll have something to cut my teeth on between jotto-by-email rounds with [livejournal.com profile] queue. This would have the very beneficial side effect of making me Really Learn Perl.



Step1: write a program that will play "Jotto: Guess My Word".

-requires a function to randomly pick a secret word, and another function to report the score of the user's guessed word.
-enhancement: check to see if user's word would be allowed given previous guesses.

Step2: write "Jotto: Guess Your Word".

-requires an AI. Best I've seen described on the net is an algorithm that keeps track of the set of all possible possible words given previous guesses (which is not hard), and randomly picks a word from that set each round. The author of this AI said he could rarely beat it.
-enhancement: write "Jotto: Guess My Own Word", ie have the program play Jotto against itself. Iterate enough times for the same secret word and calculate an average number of guesses that secret word requires. Record this "par" value for every word in the dictionary. Have J:GMW and J:GYW report the par score at the end of each game. This is a distraction from the main project, but I'm really curious.

Step3: write "Evil Jotto".

-Requires smarter AI. That the above AI can be improved upon should be clear from this observation: "fuzzy" is a bad first-guess word, since over 2/3 of 5-letter words have no f, u, z, or y. At any time, the best guess will be one that divides the possible-word space most evenly between answers of 0, 1, 2, 3, 4, and 5. In the ideal case, this would rule out 5/6 of the remaining words, as opposed to 1/3 in the likely case for "fuzzy". It will require some mathematical thinking to come up with the best way of calculating this quality.
-This will be processor-intensive. Need to make sure that the algorithm that calculates the score of a guess is optimized. I may need to determine a ceiling of word-space space size above which the program uses the dumb AI. However, I could come up with an "opening book" of first-guess words that are good.

-Step4: write "Jotto Master".

-This would be the cleaned-up version that I make available to the world, with options to play J:GMW, J:GYW, and J: Guess Each-Others' Words (the 2-player game). Have user-definable dictionary and various kinds of smartness in the user interface.
-For maximum Evilness, have an option to usually pick secret words with a high "par" value for the user to guess.

I imagine this would be the hardest step, since it would take a lot of research to find out how to make the program run happily in various settings, and satisfy various user desires.

Date: 2002-01-22 06:02 am (UTC)
From: [identity profile] queue.livejournal.com
I was thinking about doing this, also as a nice incentive to get myself to learn perl, but I just don't have the time. I have a lot of other things that I'd probably do first, if I had the time. Of course, I really would like to get back into programming some day. Maybe your getting into this might spur me into action.

In any case, good luck on the project, and I'd love to discuss a smarter AI sometime.

Date: 2002-01-22 09:45 am (UTC)
From: [identity profile] mattlistener.livejournal.com
Thanks! I've already heard back from two of the three people I wrote to last night asking for code. One gave me links to code straightaway, and also links to useful discussion I hadn't found on the fun-with-perl archive. The other expressed amazement that we were able to play guess-only-possible-words, and promised to send code. Yay!

I've never taken comp sci, nor ever written a perl program longer than 10 lines, but the degree to which I've been able to think about this like a mathematically-minded programmer is heartening!

Date: 2002-01-22 10:48 am (UTC)
From: [identity profile] queue.livejournal.com
I'd be interested to see any code you manage to come up with. What would be really cool is if I ever managed to come up with something and we did dueling AI's.

Date: 2002-01-22 05:36 pm (UTC)
From: [identity profile] mattlistener.livejournal.com
Woo, fun!

Wouldn't *that* make for an interesting Fun-With-Perl writeup?

-Matt, now in search of a wordlist that omits proper nouns like "texas" and technical jargon like "abohm" yet includes upstanding words like "ethic"... I'll probably end up sifting through diffs and putting together my own.

Date: 2002-01-22 07:06 pm (UTC)
From: [identity profile] queue.livejournal.com
I'm pretty sure there are Scrabble word lists out there. Just grab the 5 letter words from one of those.

Date: 2002-01-22 08:56 pm (UTC)
From: [identity profile] mattlistener.livejournal.com
My concern with that idea is that the Scrabble dictionary has something like three times more words than the average educated American knows. But, I could give the user their choice of dictionaries...

Date: 2002-01-23 06:11 am (UTC)
From: [identity profile] queue.livejournal.com
Of course, for the AI to be able to guess words, it needs a full dictionary. You can just pare down its allowable choices for its own words if the user requests it.

re: texas

Date: 2002-01-23 09:53 am (UTC)
From: [identity profile] magid.livejournal.com
"texas" is actually not only a proper noun, but also a garden variety noun.

according to webster's, it is
"A structure on a river steamboat containing the pilothouse and the officers' quarters."

Re: texas

Date: 2002-01-23 10:08 am (UTC)
From: [identity profile] mattlistener.livejournal.com
Aha! Didn't know that. Thanks. :-)

Another welcome side-effect of this project is that my vocabulary of 5-letter words is going to improve markedly!

Profile

mattlistener

January 2014

S M T W T F S
   1234
567891011
12131415161718
19202122232425
2627 28293031 

Style Credit

Expand Cut Tags

No cut tags
Page generated Jan. 12th, 2026 09:58 am
Powered by Dreamwidth Studios