Posts

Showing posts from 2011

C Program to solve a 9*9 Sudoku

Here is a program that I wrote to solve Sudoku sometime back. Posting on the blog now. #include int show_sudoku(); static int sudoku_nos[9][9]= { {3,0,5,4,0,1,6,0,2}, {0,0,0,0,0,0,0,5,1}, {6,0,0,0,0,9,7,0,0}, {0,0,0,0,0,0,0,0,4}, {0,0,0,6,4,5,0,0,9}, {4,3,7,0,0,8,2,0,5}, {0,0,0,0,6,2,0,0,0}, {0,5,4,0,1,0,0,8,6}, {8,7,0,0,5,0,1,2,0} }; static short int vals_g[]={1,2,3,4,5,6,7,8,9}; static short int others_options[]={1,2,3,4,5,6,7,8,9}; int show_possiblities(int i, int j,short int vals[]) { int m=0,n=0,count=9,udi=0; for(m=0;m<9;m++) { if(sudoku_nos[i][m]!=0) { vals[sudoku_nos[i][m]-1]=0; count--; } } for(m=0;m<9;m++) { if((sudoku_nos[m][j]!=0)&& vals[sudoku_nos[m][j]-1]!=0) { vals[sudoku_nos[m][j]-1]=0; count--; } } for(m=(i-(i%3));m<((i-(i%3))+3);m++) {    for(n=(j-(j%3));n<((j-(j%3))+3);n++) { if((sudoku_nos[m][n]!=0)&& vals[sudoku_nos[m][n]-1]!=0) { vals[sud

Name search

The search for the name for the newcomer in the family was not an easy task. Firstly I tried google, which gives links to websites with many Indian names. Which to me were quite heard of types. Or they were too much unheard of. Due to sheer enthusiasm for a perfect name I downloaded Mudgala Kosha   which is kind of encyclopedia of sanskrit words / meanings with online search urls. Finally after a lot of proposals and discarding Ashwini and I could agree on Atharv. For this name we didn't need the dictionary at all. Its a known name. Anyways to preserve my time spent here is the list of names that made to the shortlist: अथर्व  अमेय  वरद अमोघ -  A name of Lord गणेश परम - the supreme कराट   m.   N.   of   गण ेश   MaitrS.   [#45905]   [Img:255,2] अ क्षज  /  अ क्ष--ज  m.  a  diamond   [#442]   [Img:3,1] [442]   अ क्षज  /  अ क्ष--ज  m.  a  thunderbolt   [#443]   [Img:3,1] [443]   अ क्षज  /  अ क्ष--ज  m.   N.   of   विष्णु  .  [#444]   [Img:3,1] अद्वय अयाचित अरुष म यूख म ह