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.
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
Wooops, when I fixed a bug (had to make the input case insensitive) I edited my post, but failed to link to the correct URLs and linked to buggy ones instead (the code one isn't even a real URL).
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.
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).
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?
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 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.
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.
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.
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!)
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
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).
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.
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.
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.
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?