Problem 3-7: Scramble

A few years ago, Scramble was a popular game on smartphones, where you had to find as many words as possible before the timer goes off. The letters can be connected vertically, horizontally or diagonally. Some words you may see here are THIS, SING, SINE, RED and GEAR. You may have heard of it as “Word Streak with Friends”. This is a screen capture of what it looked like on an Android phone.

Screen Shot 2016-02-04 at 5.43.22 AM.png

In this Problem 3-7, you will complete CS50’s implementation of this game. Then you can play your own version!

A few things to understand before you get into this problem:


When programming, it is often convenient to have a single name with which to refer to a group of a related values. Structs provide a way of storing many different values in variables of potentially different types under the same name.

strcmp(string1, string2)

String compare compares two strings and returns 0 if they are equal. So for example

if (strcmp(s, “SCRAMBLE”) == 0)

will be true if the string contained in the variable s is “SCRAMBLE”.

In fact it returns an integer less than, equal to, or greater than zero if string1 is found, respectively, to be less than, to match, or be greater than string2.

Linear Search

Binary Search

That should hopefully give you enough to at least get you started on Problem 3-7. Enjoy!