Click here to Skip to main content
13,042,819 members (83,575 online)
Click here to Skip to main content
Add your own
alternative version


22 bookmarked
Posted 27 Nov 2008

Solver for Scramble by Zynga

, 27 Nov 2008
Rate this:
Please Sign up or sign in to vote.
Program to automatically list all the possible words in the game Scramble on Facebook


This is basically a program to cheat at the Scramble word game located on Facebook. It also contains the option to play the Word Twist Game as well.

The scramble game is just a square board with letters on it. You have to find as many words as possible in three minutes. You can start with any letter, but you can only move to another letter that is touching or diagonal to the current letter.  You also can't use the same letter more than once for each word.


This was an interesting program to write. The first challenge to overcome was coming up with a list of possible words, or a dictionary as I called it. I ended up stripping off all the words from an online crossword dictionary which I think the Scramble program itself used to display the definitions of the words. It showed only fifty words per page, and there were over 2000 pages. It took about 35 minutes to download all 105,000 words, and it crashed Visual Studio when I tried to paste all 105,000 lines of code into my class file. I ended up using Notepad++ to create the file, then added it to the project.

The second challenge was trying to come up with an efficient way of organizing the board to search through the possible paths. I first created a 2 dimensional array of the board, with each item in the array containing its letter, and a list of all squares that it touches. Then I loop through each square, finding all words that start with that square.

This is achieved by first finding all the possible ways to create a word with a length of 3 (not caring if it is a valid word or not at this point).  If the word is a valid word in the dictionary, it is added to a list of found words.  If it could be the start of a longer word, it searches for all other letters that it touches to see if there are other valid words or starts to valid words. It repeats this process to find all the words on the board.

Using the Code


When you first start up the program, it takes about 10-15 seconds to load up the entire dictionary into memory. Once it loads, use the left hand Textbox for typing in the board. You can type in any size board you'd like as long as it is square. The game on Facebook only contains 4x4 and a 5x5 games.

After you have the board entered, push the "Go" button and all the possible words are either listed in the list box, or are copied one at a time to your clipboard, one each second, depending  whether or not the "Use Clipboard" checkbox is checked or not.

Points of Interest

There is nothing too amazing about the code itself, only that it has a class with 105000 lines of code. I'm sure there is a better way to do this, but for a fun project like this, I really didn't care.

I was able to score 1553 points using this program, which is 1400 points more than any of my friends on Facebook. So funny.


  • 27th November, 2008: Initial post


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

United States United States
No Biography provided

You may also be interested in...

Comments and Discussions

QuestionExactly what I needed. Neat coding, thanks. Pin
Emre201320-Feb-13 16:42
memberEmre201320-Feb-13 16:42 
GeneralMy vote of 5 Pin
Emre201320-Feb-13 16:08
memberEmre201320-Feb-13 16:08 
Questionprocess method? Pin
Lhocu21-Nov-11 14:37
memberLhocu21-Nov-11 14:37 
AnswerRe: process method? Pin
dlabar21-Nov-11 16:27
memberdlabar21-Nov-11 16:27 
GeneralRe: process method? Pin
Lhocu24-Nov-11 16:05
memberLhocu24-Nov-11 16:05 
GeneralMy vote of 1 Pin
crashandburn531-Oct-11 11:48
membercrashandburn531-Oct-11 11:48 
GeneralRe: My vote of 1 Pin
Lhocu21-Nov-11 14:41
memberLhocu21-Nov-11 14:41 
GeneralWindows XP won't acknowledge this program Pin
Becky Althoff25-Jun-09 11:24
memberBecky Althoff25-Jun-09 11:24 
QuestionHow do I run this in windows xp? Pin
Matt witt16-Mar-09 17:06
memberMatt witt16-Mar-09 17:06 
QuestionVB Version? Pin
Member 41501809-Jan-09 8:06
memberMember 41501809-Jan-09 8:06 
QuestionCan U write in Pin
rqwe26-Dec-08 11:36
memberrqwe26-Dec-08 11:36 
GeneralMy vote of 1 Pin
saddestwhisper25-Dec-08 19:43
membersaddestwhisper25-Dec-08 19:43 
Questionwots the deal ? how to install and run the code ? Pin
spice_lover22-Dec-08 13:26
memberspice_lover22-Dec-08 13:26 
GeneralMissing Resources.rsx Pin
keith.b2-Dec-08 7:32
memberkeith.b2-Dec-08 7:32 
GeneralMy vote of 2 Pin
Gwannoes2-Dec-08 1:42
memberGwannoes2-Dec-08 1:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170713.1 | Last Updated 27 Nov 2008
Article Copyright 2008 by dlabar
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid