Guess my word
11–20 of 60 posts
Re: Guess my word
#12I 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 o…
Getting past the idea of having wine with breakfast(!) what's in your personal Italian blend?
Re: Guess my word
#13 > 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.Re: Guess my word
#14Earlier quoted context omitted.
Getting past the idea of having wine with breakfast(!) what's in your personal Italian blend?
It could be that the wine was used to cook, not drink. Just guessing :)
Re: Guess my word
#15Re: Guess my word
#16Re: Guess my word
#17https://jsfiddle.net/fsc5v4v0/9/embedded/result/
And here's the code: 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
Re: Guess my word
#18It'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. ;)
3rd visible line on links: http://simbase.org/gmw/guess.cgi?by=joon&result=leaderboard http://simbase.org/simbase/leagues/simbasev3/gmw/guess.cgi?b...
Re: Guess my word
#19It'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. ;)
Re: Guess my word
#20I wanted more :) So here's my blatant clone sourcing words from the internet: https://jsfiddle.net/fsc5v4v0/9/embedded/result/ And here's the code: 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