Cheating for Fun
I recently checked out the Scramble application on Facebook, which is a knock-off of Boggle. It’s a fun diversion, even though I usually get my ass kicked. There’s an annoying chat window there, too, and invariably someone will accuse someone else of cheating, at which point a number of people will pipe up with “how would you cheat?”
This got me thinking…how *would* you cheat? You’d just have to write a Scramble puzzle solver that spit out all the words in on the board. That sounded like a fun problem. I hadn’t done anything with recursion in a while, so I gave it a go. Below is what I came up with. You’ll need a word list to run it. I originally used /usr/share/dict/words, but it was missing a lot of valid words (I think it only has base words, no plurals or tenses). So I stole the scrabble word list from the Debian scrabble package, which worked much better.
Anyway, here you go:
I did try this out a couple times on Scramble and won handily. There’s really not much fun in that, though.
Update: I posted this in one of the comments below, but I’ll put it here as well to make sure everyone sees it: This was really just an exercise in coming up with a fun algorithm, and is primarily intended for programmers. If you’re just looking to cheat at Boggle/Scramble, there are plenty of web sites that will help you with that, and with a lot less effort.
December 5th, 2007 at 9:38 am
Brad, you’ve turned me into a winner. Thanks!
December 11th, 2007 at 2:30 am
i cant get this thing run… it just shows me a txt file…
December 11th, 2007 at 6:42 am
Matrix – I named the file boggler.txt because (a) WordPress wouldn’t let me upload a .rb file, and (b) I wanted people to be able to click on it and view the source, rather than have to download it first. You just have to download it to your machine and run it from there (you’ll need ruby installed, of course: http://www.ruby-lang.org/).
January 22nd, 2008 at 11:37 pm
can this run on a mac?
January 22nd, 2008 at 11:50 pm
Sure, that’s what I wrote it on. You just have to install ruby.
February 13th, 2008 at 12:55 pm
[...] http://blog.footle.org/2007/12/05/cheating-for-fun/ [...]
February 20th, 2008 at 4:51 am
Sorry to be a newbie, how to change from .txt file to .rb???
March 8th, 2008 at 11:51 pm
help. how do i use all the stuff that i downloaded i have no idea what to do
March 10th, 2008 at 4:26 pm
I don’t seem to know how to get this to work after I get Ruby and then the code and words. Would anyone like to give me any help?
March 10th, 2008 at 4:35 pm
moon/shannyant/Andrew – This was really just an exercise in coming up with a fun algorithm, and is primarily intended for programmers. If you’re just looking to cheat at Boggle/Scramble, there are plenty of web sites that will help you with that: http://www.l.google.com/search?q=cheat+boggle
March 22nd, 2008 at 8:27 am
HELP!!!
I downloaded ruby, or well.. “locamotive” and i just want it to go away now. I’m a premed student and can tell you a ton about the human body but absolutely nothing about computers. Please help me get rid of this. :( Ps. I’m trying to get it off my macbook.
March 22nd, 2008 at 8:46 am
Ally- I’m pretty sure there’s not anything more to uninstalling than just dragging the Locomotive folder in Applications to the trash.
March 26th, 2008 at 10:49 am
I think it’s gone now. goodness I’m slow…
April 23rd, 2008 at 3:26 am
Interesting, but I assume that Ruby is not supported on Vista?
July 1st, 2008 at 11:14 am
Hi i got this running in cmd but am new to ruby.. How do i get it to output on to the board?
August 6th, 2008 at 2:11 am
Hi i got ruby etc i got the coding up but what do i do now ?
September 11th, 2009 at 10:09 am
Very interesting, hopefully i can this working and install ruby! Thanks for sharing :)