The Future Is Here
We may earn a commission from links on this page

Singapore's Prime Minister Has Published His Own C++ Sudoku Solver

We may earn a commission from links on this page.

Everyone needs a hobby. For Lee Hsien Loon, that happens to be writing C++ Sudoku solvers and publishing them on the Internet. Lee Hsien Loong also happens to be the Prime Minister of Singapore.

His pastime came to light during a speech he gave last month to a group of technology industry leaders. Then, he explained:

“The last program I wrote was a Sudoku solver in C++ several years ago, so I’m out of date. My children are in IT, two of them—both graduated from MIT. One of them browsed a book and said, ‘Here, read this.’ One day that will be my retirement reading.”


Since, he’s decided to make his code public. Yesterday he posted his code a to a Google Drive folder and shared the link on Faceboook, adding:

“The program is pretty basic: it runs at the command prompt, in a DOS window. Type in the data line by line (e.g. 1-3-8—-6), then the solver will print out the solution (or all the solutions if there are several), the number of steps the program took searching for the solution, plus some search statistics. Hope you have fun playing with this. Please tell me if you find any bugs!”


So, now you can go and play around with the Prime Minister of Singapore’s code. Which is kinda fun. It’s perhaps not surprising that he’s played around with C++. As an undergraduate, he studied mathematics at Trinity College, Cambridge—regarded by many as the leading destination for talented mathematicians (it’s spawned no fewer than five Fields Medal winners). [Ars Technica]