PM Lee Hsien Loong posts source code for sudoku solver. Experts give their take

PM Lee has been commended for being "cool", "awesome" and "amazing" after posting on Facebook a source code he created to solve sudoku puzzles. -- ST PHOTO: LIM SIN THAI 
PM Lee has been commended for being "cool", "awesome" and "amazing" after posting on Facebook a source code he created to solve sudoku puzzles. -- ST PHOTO: LIM SIN THAI 

SINGAPORE - Prime Minister Lee Hsien Loong has been commended for being "cool", "awesome" and "amazing" after posting on Facebook a source code he created to solve sudoku puzzles. But is his code any good?

According to two university staff who are well-versed in code, it is.

Associate Professor Ng Wee Keong, Associate Chair of Research at Nanyang Technological University's School of Computer Engineering, said that the code is "well structured" while senior lecturer Aaron Tan from the School of Computing in the National University of Singapore said it was "well-written".

//

"It shows the programmer's mastery of logic and design methodology," Mr Tan said. Mr Ng, while acknowledging the the code is clean and easy to understand, said it would be good if it comes with comments.

"Comments are essential when the code is huge and complex. The written source code compiled fine and seems to run correctly," he said.

Both experts said that the source code is in C, as opposed to the C++ PM Lee had said the code was in.

Explaining why PM Lee could have said it was written in C++, Mr Tan said: "It is not wrong to say that it is a C++ program (since it can be
compiled perfectly well with a C++ compiler)-just that it is written in C style."

Mr Ng said that all the computer science and engineering students at his school will have to learn this basic programming language during their first year of study, and that it would take one or two courses in structured programming to write a similar Sudoku solver program.

People who commented on PM Lee's Monday post said they were surprised by his knowledge of programming code, but others also pointed out news articles that reported that PM Lee was the senior wrangler, or top mathematics undergraduate in Cambridge University's Trinity College.

Some termed him a "techie" and invited him to technology festivals, while others took his ability to come up with the code as a good sign of his ability to solve problem in chaos. Within a day, his post was shared 12,000 times and received more than 36,000 likes. It was also reported on BBC website.

One netizen who goes by the name JChou Chung said: "I see a leader with systematical, methodical and well-organized traits putting things in good order. Impressive!"

jalmsab@sph.com.sg

Join ST's WhatsApp Channel and get the latest news and must-reads.