« Cheaters Never Prosper, Or Do They? | Main | Correctness and Finishedness »

Sudoku Puzzles and Computer Science

I have to admit that I'm a bit of a Sudoku addict. Rarely has a morning gone by that I don't play one or two of the many on-line versions of Sudoku that are available across the internet.

If you've somehow missed the Sudoku craze, it is a very simple number puzzle. You are given a 9x9 grid with some of the squares filled in with numbers between 1 and 9. Your job is to complete the grid so that each number from 1 to 9 appears once in every row, once in every column, and once in each of nine 3x3 subgrids.


For example, in the above grid, you can confidently put a 5 in the shaded box. Here's why. You need a 5 somewhere in the second column. Because there's already a 5 in the top-left and bottom-left 3x3 subgrids, the 5 must go in the middle-left subgrid. And in the middle-left subgrid, the 5 has to appear in the fourth row. (As a good teacher, I'll leave it to you as an exercise to figure out why!)

To solve a puzzle, you fill in all of the empty squares by process of elimination. Depending on how many squares have already been filled in for you, this can be very easy or very hard.

So what does this have to do with computer science?

The other day I was talking with some fellow Sudoku fanatics when one of them mentioned that her daughter was particularly good at solving these puzzles. She said, "My daughter has this innate ability to recognize the patterns that occur."

And then in her next breath, she said, "I wonder what sorts of careers would use that talent."

Bingo. (The exclamation, not the career.)

"Has she considered computer science?", I asked.

"Computer science? Gosh no. The last thing my daughter wants to do is to sit in front of a computer screen all day."

Naturally, this was my opportunity to tell her about what computer science really is. It's not just programming (though a typical computer scientist does some of that as well). Rather, it's about problem-solving and algorithmic thinking. The pattern recognition skills her daughter has in Sudoku will serve her well as a computer scientist.

Finally, the thrill we Sudoku-lovers get when we finish a challenging puzzle is the same excitement I get when I solve an algorithms problem that has been particularly vexing. That satisfaction is what makes computer science so enjoyable.

While I'm not sure that my friend's daughter is going to rush out and sign up for a computer science course, I feel fairly confident that she'll at least consider the possibility the next time she has to sign up for classes. It's conversations like this one that will help people to understand what computer science is and help to strengthen the role of computer science in K-12 education.

Robb Cutler
President, CSTA


I had never played Sudoku before, but since this is the second time I've seen it referred to by a CS-type person, I thought I'd check it out. I first found http://www.sudoku.com, and had a transformative moment. Right there on the front of the page it says "There's no math involved". No math!! I had avoided the game after the first person recommended it, with vague comments about how busy I am. In reality, I have a math disability and have a hard time doing simple calculations. I didn't understand that you don't have to do any addition or other math, you just have to be good at pattern recognition! This seems like a metaphor for computer science, at least in my experience. While there are certainly areas where a deep understanding of mathematics is required, at the K-12 level, the discipline stands alone. We can't afford to scare students off by tying CS to math.

Now that I've tried playing at http://www.websudoku.com, I'm hooked. The other thing I noticed as I played is that there are multiple strategies that a player can use and be successful. Of course, like so many things, using more than one is optimal. I think I'll take the game into my class and let the students experiment and discuss the different algorithms they use to attack the problem. Lots more fun than some dry discussion!

I'm going to add Sudoku to my recruitment brochure, which has a section that begins with something like "You'll probably like programming if you like..." (I typically distribute copies in Algebra II classes and to students who've been suggested to me by their math teachers.)

Michelle, with all due respect, CS is all maths!

Frankly, I think that math class is not necessarily the first place to look for CS students. I had great luck recruiting from foreign language classes. After all, they already get the concept of “talking” in a different syntax and translating what they are thinking into different words. And very bright students congregate there too.

Dear Sir,

I am a Software training faculty and very much interested in online teaching. Can u help in this regard? Please tell me, How can I get registered with CSTA?

Yours truly,
Ramana. (gvramana97@yahoo.com)

Hi, I am considering, no, make that in great need of a career change. I have a BA and sales/managment experience, and am so burnt out I have to make a change. What is a good introductory computer science course I could take to explore? Should I start with Java? ...I love sudoku and math, though have no math beyond business calculus.

Interesting post, thanks!

Hi, your pos is very interesting, I found a site with sudoku on-line puzzles also known as судоку. I think many people will like that.

Puzzles such as Sudoku are a great way of getting young children to use and practice their skills of logic and deduction without it seeming too much like homework! Interesting post.

Im a bit of a Sudoku addict as well. I only started playing about 1 year ago, but I think my background in web development (PHP, MySQL) has definitely helped me out with the puzzles because, like you say, you must solve problems with an algorithmic frame of mind.

Sadly, I do not have the natural talent for Sudoku. I am pretty good, but Im definitely not a prodigy or anything.

By the way, have you seen the World Champion of Sudoku for 2010? I wrote up a post about it on my Sudoku blog if you want to check him out.


Maybe you'll like it, pretty cool. The guy must be a math genius!

Sudoku, simply defined, is a puzzle based on numbers and logic. The game requires filling the vacant boxes of a 9X9 grid with single digit numbers so that on completion - each column, each row, and each of the nine 3X3 sub-grids that constitute the overall grid contains all of the digits from 1 to 9.

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)