Singapore's Prime Minister Shares His C++ Sudoku Solver Code
itwbennett writes: Several weeks ago, during a speech at the Founders Forum Smart Nation Singapore Reception, Singapore's prime minister Lee Hsien Loong said that he used to enjoy programming, and that the last program he wrote was a Sudoku solver in C++. To back that up, earlier today he announced (on Facebook and Twitter) that his code is available to download. He wrote on Facebook that he wrote the program 'several years ago' and that the code does 'a backtrack search, choosing the next cell to guess which minimises the fanout.'
after all our President is a "coder" too!!! :eyeroll:
"I don't know, therefore Aliens" Wafflebox1
There should be an international coding competition between heads of state.
It might be a 'stupid sudoku solver', like you say, but at least, that is a program that does something, rather than the congress critters who do nothing but producing massive amount of HOT AIR
Imagine that you are a zombie apocalypse survivor, naked and wet, in a freezing winter Alaskan night, tired to death, and you can share a tent either with this Singapore's prime minister who wants you to stay awake with him and solve stupid Sudoku puzzles or with one of those "congress critters who do nothing but producing massive amount of HOT AIR" - who would be you choice?
Antisthenes: "Wisdom begins by examining the words/names." - excuse my English, i am (slightly...) better with my Greek!
You never heard of the Obfuscated_C_Code_Contest. Who knows what this "Sudoku Solver Code" actually does? It could be a Trojan horse to steal American freedoms.
but our former prime-minister had a restaurant... our great Greek dinner with mousaka,
Which one? You'd have hoped with that experience he might have had some idea how to balance the books. Did his restaurant go broke?
Its not C++ code because the code is understandable. For example:
1. he does not use templates, restricting himself to solving only over the integer space. what about a sudoku puzzle of strings? basics, people, this is basic stuff.
2. he is using raw loops. what about range based bi-directional iterators using lambdas? scott meyers is going to throw a tantrum.
3. free functions without namespaces or a class even. more appropriate would have been korea::south::presidental_code::sudoku_solver.
4. better yet, abstract it all away in a templated class, be sure to overload all the operators, implement copy-on-write and do the non-public stuff in a pimpl that relies some weird over-engineered templated-to-death library from boost. and make that shit virtual.
5. and be sure to do all of the above multi-threaded, since you need to scale to multiple cores these days.
I have been around for a long time and no well adjusted kid has ever known what a binary integer was let alone a trick that utilizes it to determine the largest power of two that divides it.
a C programmer would put it as void Succeed(void)
A C programmer would put it as 'void succeed()' or even 'succeed()'.
Slashdot, fix the reply notifications... You won't get away with it...