雖然這篇Sudoku-solver github鄉民發文沒有被收入到精華區:在Sudoku-solver github這個話題中,我們另外找到其它相關的精選爆讚文章
在 sudoku-solver產品中有2篇Facebook貼文,粉絲數超過34萬的網紅堅離地城:沈旭暉國際生活台 Simon's Glos World,也在其Facebook貼文中提到, [新加坡Vs香港篇] 新加坡總理李顯龍在個人 Facebook 專頁,分享多年前運用 C++ 寫出數獨破解程式 (Sudoku solver),顯示其政治、經濟、軍事、音樂等領域以外又一實戰經驗...... ...
同時也有10000部Youtube影片,追蹤數超過2,910的網紅コバにゃんチャンネル,也在其Youtube影片中提到,...
sudoku-solver 在 堅離地城:沈旭暉國際生活台 Simon's Glos World Facebook 的最讚貼文
[新加坡Vs香港篇]
新加坡總理李顯龍在個人 Facebook 專頁,分享多年前運用 C++ 寫出數獨破解程式 (Sudoku solver),顯示其政治、經濟、軍事、音樂等領域以外又一實戰經驗......
sudoku-solver 在 Lee Hsien Loong Facebook 的最讚貼文
I told the Founders Forum two weeks ago that the last computer program I wrote was a Sudoku solver, written in C++ several years ago (http://bit.ly/1DMK5Zk). Someone asked me for it. Here is the source code, the exe file, and a sample printout - http://bit.ly/1zAXbua
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.
For techies: the program does a backtrack search, choosing the next cell to guess which minimises the fanout.
Here’s a question for those reading the source code: if x is an (binary) integer, what does (x & -x) compute?
Hope you have fun playing with this. Please tell me if you find any bugs! – LHL
#SmartNation
===========
Answer: As several of you noted, (x & –x) returns the least significant ‘1’ bit of x, i.e. the highest power of two that divides x. This assumes two’s complement notation for negative numbers, as some of you also pointed out. e.g. if x=12 (binary 1100), then (x & -x) = 4 (binary 100). I didn’t invent this; it is an old programming trick. :)
===========
Update: A few people suggested that I add a licence to the code. Have added it in the Google Drive folder.