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.

17 Responses to “Cheating for Fun”

  1. Tony Stubblebine Says:

    Brad, you’ve turned me into a winner. Thanks!

  2. Matrix Says:

    i cant get this thing run… it just shows me a txt file…

  3. brad Says:

    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/).

  4. Anonymous Says:

    can this run on a mac?

  5. brad Says:

    Sure, that’s what I wrote it on. You just have to install ruby.

  6. Cheating for Fun Says:

    [...] http://blog.footle.org/2007/12/05/cheating-for-fun/ [...]

  7. moon Says:

    Sorry to be a newbie, how to change from .txt file to .rb???

  8. shannyant Says:

    help. how do i use all the stuff that i downloaded i have no idea what to do

  9. Andrew Says:

    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?

  10. brad Says:

    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

  11. ally Says:

    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.

  12. brad Says:

    Ally- I’m pretty sure there’s not anything more to uninstalling than just dragging the Locomotive folder in Applications to the trash.

  13. ally Says:

    I think it’s gone now. goodness I’m slow…

  14. Anonymous Says:

    Interesting, but I assume that Ruby is not supported on Vista?

  15. john Says:

    Hi i got this running in cmd but am new to ruby.. How do i get it to output on to the board?

  16. ell Says:

    Hi i got ruby etc i got the coding up but what do i do now ?

  17. ramen Says:

    Very interesting, hopefully i can this working and install ruby! Thanks for sharing :)


Bad Behavior has blocked 102 access attempts in the last 7 days.