As It Happens

Singapore PM writes code that solves sudoku puzzles

When he's not dealing with world issues, the prime minister of Singapore writes code. Lee Hsien Loong has created a computer program that solves sudoku puzzles. He posted it online yesterday.
Yesterday, the Prime Minister of Singapore Lee Hsien Loong posted code for a sudoku solving computer program online. (Reuters/Facebook page of Lee Hsien Loong)

When he's not dealing with world issues, the Prime Minister of Singapore has a surprising hobby. He writes code. More specifically, he has created a program that solves sudoku puzzles.

On Monday, Prime Minister Lee Hsien Loong posted code for his program on his Facebook page. It has since gained widespread praise from computer programmers and sudoku lovers around the world.

But creating code to solve puzzles isn't new.

According to self-proclaimed puzzle-head Will Shortz, people have been writing code to solve sudokus since they first grew in popularity around 2005. 

Shortz tells As it Happens co-host Carol Off that this could take the fun out of doing a puzzle.

"With a sudoku or a crossword there is a perfect solution. And, it's very satisfying to write it. It's something you're going to want to do yourself," he says.

Will Shortz is the chairman of the World Puzzle Association and the crossword editor for the New York Times. (Will Shortz )

Shortz works as the crossword editor for the New York Times. He's also the chairman of the World Puzzle Federation which holds yearly sudoku competitions around the world. 

"There's a great satisfaction in creating a new kind of puzzle...and I bet what the Prime Minister did was satisfying to him. He solved a puzzle in a way."

Even though he wouldn't use the prime minister's program, Shortz can appreciate his work.

"I am very impressed that a leader of a country is so brainy...Can you imagine the leader of Canada or the United States writing a sudoku program? You'd almost be laughed out of office."


To encourage thoughtful and respectful conversations, first and last names will appear with each submission to CBC/Radio-Canada's online communities (except in children and youth-oriented communities). Pseudonyms will no longer be permitted.

By submitting a comment, you accept that CBC has the right to reproduce and publish that comment in whole or in part, in any manner CBC chooses. Please note that CBC does not endorse the opinions expressed in comments. Comments on this story are moderated according to our Submission Guidelines. Comments are welcome while open. We reserve the right to close comments at any time.

Become a CBC Member

Join the conversation  Create account

Already have an account?