
Guess my word - ColinWright
http://simbase.org/gmw/gmw.html?HN_20150905
======
bonobo3000
This is great! Inspired me to make a little script in spark-shell:

    
    
        > val words = oxforddict.
                    filter{case s => s.exists(_.isLetter) && s.forall(Character.isUpperCase(_))}.
                    distinct.
                    map((_.toLowerCase,1))
    
        > def lcp(a:String,b:String) = { a.zip(b).takeWhile(Function.tupled(_ == _)).map(_._1).mkString }
        > implicit val wordOrdering = new Ordering[String] {
        >   override def compare(a:String, b:String) = { val lcpIdx = lcp(a,b).length; a.substring(lcpIdx).compareTo(b.substring(lcpIdx)) }
        > } 
        
        > def nextGuess(lower:String,upper:String,g:Int) = { val candidates = words.filterByRange(lower,upper).map(_._1).collect.sorted(wordOrdering).toList; val mid = candidates.length / 2; candidates.slice(mid-g/2,mid+g/2+1) }
        nextGuess: (lower: String, upper: String, g: Int)
    
        > nextGuess("prejudice","promise",1)
        res42: List[String] = List(primeness)
        > nextGuess("prime","promise",10)
        res47: List[String] = List(procris, procrustean, procrusteanize, procrustes, procrustesian, proctitis, proctocele, proctodaeum, proctor, proctorage, proctorial)
        > nextGuess("proctor","promise",10)
        res48: List[String] = List(profulgent, profundity, profuse, profusely, profuseness, profusion, profusive, prog, progenerate, progeneration, progenitor)
        > nextGuess("profuse","promise",12)
        ding ding!!
    

I love HN, and I love scala :D Thanks for posting OP. HN needs more great
technical content like this and less opinion & news, in my opinion.

~~~
normac
This raises an interesting problem--could we find the word even faster by
using something other than a standard binary search?

The first thing that comes to mind is skipping past letters that don't appear
very often at that point in a word with the current prefix--or to be more
granular, you could change your counter (here g) to a float and somehow weight
each letter by how rarely it occurs after the letters you've established so
far. So if you've currently established that the first four letters are "pro,"
and "z" almost never occurs after those letters, "z" might be given a weight
above 1 so the counter skips right past it.

------
kaoD
I wanted _more_ :) So here's my blatant clone sourcing words from the
internet:

[https://jsfiddle.net/fsc5v4v0/9/embedded/result/](https://jsfiddle.net/fsc5v4v0/9/embedded/result/)

And here's the code:
[https://jsfiddle.net/fsc5v4v0/89/](https://jsfiddle.net/fsc5v4v0/89/)

I hope it's bug free. jQuery is really a pain to reason about, so much
implicit state all over the place. I thought React might've been a bit too
much, but halfway through it I started reconsidering my choice :P

~~~
hlmencken
This is cool but when i gave up it said congratulations and didn't show me the
word.

~~~
kaoD
Sorry, completely failed linking the URL. See sibling comment for the real
ones :)

------
louhike
Maybe you should not make answers.json public.

~~~
totony
Doesn't matter, the checking is made in Javascript, so you can console.log(
answer ) if you want to cheat anyway

------
jjuhl
Isn't this simply a game about how to do a binary search of a dictionary? How
is that exciting?

~~~
furyofantares
I think it's more about how difficult it can be to do a binary search of the
dictionary in your head. I don't want to spoil today's word, and I've tried
not to below, although there are minor spoilers.

Once I started to narrow it down it became difficult to find words between my
constraints. In one case I was making assumptions about what letters can come
after other ones while trying to generate a new word (and being aware of this
isn't enough to stop it.) And then, in the last case, when I had it narrowed
between <xyz> and <xyz>ed (think jump and jumped, for example), my brain only
wanted to search for words that were conceptually related to xyz. This was a
mistake, the goal word started with xyz but was not related to it
conceptually, but again, an awareness that my brain was favoring a search of
the concept space rather than searching the dictionary alphabetically was not
enough to remedy it.

~~~
organsnyder
I had the same experience. I locked in to the first letter within a few
guesses, but then struggled to find words that began with the second letter I
wanted to guess. Eventually, I realized that, since I was on my phone, I could
take advantage of predictive text to help me out (okay... "cheat" is probably
more accurate). I doubt that I would have figured it out on my own (due to the
word being totally unrelated to the word that makes up the first few letters).

------
dahart
Fun, I quite like it. Sad that everyone has made the leaderboard unusable, but
I'm sure the majority of the problem could be fixed in one or two lines of
code. Looks like it only became a problem today... hacker news is living up to
its name?

------
ColinWright
What a shame - a cute toy, and people just break it.

This is why we can't have nice things - remind me never to show HN anything
that's just a bit of fun. Some people really will set the world on fire just
to see if they can, and then just to watch it burn.

It's not what hacking used to be about. It used to be about making cool stuff,
and people sharing and appreciating it. Now even the simplest of toys need to
be bullet-proof and hardened.

I miss the old days.

------
DiabloD3
I love HN.

I got up early in the morning, made a nice breakfast (today? roasted turkey
legs seasoned with my own personal italian blend, with a carrot and rutabaga
mash, and a glass of whatever white wine was open and in my fridge, wasn't bad
for a $7 bottle), had a cup of coffee (fresh ground, brewed using the inverted
Aeropress method), cleaned the catbox, fed the cat (even though he probably
ate as much as I did off the turkey legs, fat bastard he is), did my morning
strength training routine, and was just waiting for it to warm up more outside
so I could go for my morning walk (September in Maine means it dips into the
40s at night and doesn't warm up into the 60s until 9am), and was otherwise
doing work (just because its Saturday doesn't mean I'm off the clock)...

... and then I check HN and find this at the top. Now I know what I'm going to
be doing for the next few hours.

~~~
petercooper
Getting past the idea of having wine with breakfast(!) what's in your personal
Italian blend?

~~~
mangamadaiyan
It could be that the wine was used to cook, not drink. Just guessing :)

~~~
dr_zoidberg
He said he had a glass, so there's the drinking. Although unusual, it's not
the first time I hear of someone drinking a glass of wine at breakfast. It's
common in some cultures.

~~~
DiabloD3
Its something I'm trying out. My culture doesn't really drink wine at all (I'm
half German, half Irish, 100% American), but since I eat one good meal a day,
I had a glass with it.

------
chippy
Note: I believe that the word stays the same each day, so there may be limited
replayability. There are two words by "joon" and "mike" to find everyday.

(I got the first in 24 tries and the second in 22 with the help of a
dictionary!)

~~~
wjoe
You can also play words from previous days by going to the leaderboard,
selecting another day at the top, then clicking "play this word"

------
reinhardt1053
Helped myself with some python, I guessed it in 16 tries.

lines = tuple(open('english_words.txt', 'r'))

min = 0;

max = len(lines)

while True :

    
    
       	index = min + (max-min)//2
    
    	print lines[index];
    
            before = raw_input("Before? y/n")
    
            if before == "y" :
    
                    max = index-1
    
    	elif before == "n" :
    
       		min = index+1
    
       	else :
    
       		break
    
    
    
    

english_words.txt can be downloaded here:
[http://www.mieliestronk.com/corncob_lowercase.txt](http://www.mieliestronk.com/corncob_lowercase.txt)

------
troels
"I couldn't find modificatory in my dictionary. Remember, you're only allowed
to guess words."

Hey - That's straight from /usr/share/dict/words

------
Gracana
Neat game, but it gave me an incorrect hint about the target word. I had
narrowed it down to somewhere in the Vs, then accidentally clicked "I give up"
and it told me the word started with a letter that comes way before v (I'm
being vague here because it looks like the word is the same for everyone and I
don't want to spoil it too badly).

------
impostervt
Could use this

[https://www.wordsapi.com](https://www.wordsapi.com)

~~~
amelius
This seems silly. Why not download the whole dictionary in one single GET.
Much faster, much less prone to failure.

------
LVB
Good stuff! I started playing it zoomed way in on my phone and had no idea the
previous guesses and bracketing words were shown. Remembering recent words
while thinking of new ones made for a nice "n-back" sort of challenge.

------
arxpoetica
It's possible to cheat on the leaderboard. Go through the game once, figure
out the word, play it again, guess the same word, first guess. Oops. ;)

~~~
drake01
Its mentioned already on Leaderboard: Select to reveal answer word:

3rd visible line on links:
[http://simbase.org/gmw/guess.cgi?by=joon&result=leaderboard](http://simbase.org/gmw/guess.cgi?by=joon&result=leaderboard)
[http://simbase.org/simbase/leagues/simbasev3/gmw/guess.cgi?b...](http://simbase.org/simbase/leagues/simbasev3/gmw/guess.cgi?by=mike&date=&sort=num&result=leaderboard)

------
minaguib
It would be nice if, while you're you're guessing, the words in your own
history have an indicator of whether each was too high or too low.

~~~
tedd4u
It does. The blue word is the closest guess before and the red word is the
closest guess after.

~~~
TazeTSchnitzel
Would be nice if it indicated it in some way beyond colour-coding, for the
benefit of the colour-blind and those who don't catch on.

~~~
monochromatic
Blue-red colorblindness?

~~~
ant6n
blue-black colorblindness at night:
[https://justgetflux.com/](https://justgetflux.com/)

------
Cyph0n
I was at 14 tries, with 3 letter accuracy. I just couldn't come up with
today's word, even though I know it well..

------
kazimuth
Apparently there's an exploit, given all of the answers with INT_MIN guesses
on the leaderboard.

------
robgibbons
Bonus round: Guess how to hack the leaderboard

------
berbc
"My word is after noon."

------
SCAQTony
That was awesome: Got it in 16 guesses and I believe this would be great for
primary schools. I am going to forward it around.

------
hoke_t

      console.log(answer)

------
jm0codes
when you type in words in alphabetic order, like "Ape, Best, Claim, Dumb", you
get to "Rate, Start" and it says after Rate, and before Start. So it must
start with R or S.

~~~
Hasu
That isn't a very efficient way to do it. Try doing a binary search. Start
with a word that starts with 'M', then if it's before, try one that starts
with 'F' or 'G', if it's after, try one that starts with 'S' or 'T'. You
eliminate roughly half the possible words with each guess that way, and you'll
get to your answer much more quickly than guessing in alphabetical order.

You could improve this method by finding out where the exact midpoint is in
the list of words by alphabetical order, as I'm not certain it's actually
halfway through the alphabet.

And I'd bet that some people here on HN could come up with even cleverer ways
to cut down on guesses.

------
MrBra
It's 2015, make it responsive, please.

~~~
cpeterso
Why bother?

~~~
MrBra
Because being a non native English speaker I had to read instructions and had
to swipe left and right at least ten times on my phone (and for what? For a
game which IMO is nothing new...).

Also being the page just a half dozen of divs making it responsive would have
been totally trivial, so why _not_ bother?

