User Profile
Collapse
-
Setting a protected network will be by far the easiest part of the work, even for an unexperienced user. And it is the easiest way for sharing data between two or more computers. You will find detailed instructions in the manual of your access-point/router, but you will need also wireless network adapters for each computer, unless you connect them with ethernet cables. TP-Link wireless adapters are very reliable and not expensive at all.... -
Yes, at the end, when going to real coding, I realized that the simplest way is to do two nested loops with a flag, and to check on the flag.
Since I am lazy, I did it in perl, but I hope that the comments could ease an eventual translation into other languages.
...Code:### sudotest.pl ### #reading the lines in the file# open(SUDOKU,"sudoku.txt") or die "No such file !"; for($i=0;$i<9;$i++){Leave a comment:
-
Ah, right! I was in a hurry and I didn't take enough time to think :)
Another algorythm could be as follows:
1) Sort the items of the array
(The result for a sudoku valid array should be ; 1 2 3 4 5 6 7 8 9)
2) check that in the sorted array item[4]=5
3) check that in the sorted array item[0]+item[8]=10
4) check that in the sorted array item[1]+item[7]=10
5) check that in the sorted array item[2]+item[6]=10...Leave a comment:
-
The idea of checksum=45 is ok, but you should check that there is no row (or column, or square) filled with all "5". This could be done by converting the array (if the checksum is 45) into a string and checking that the string does not contain the substring "55".
(if I remember well, the library function for substring matching should be strstr() )
Sorry for being so short, but I must go to our monthly LUG meeting...Leave a comment:
-
I had a similar problem with a linux box, and in my case it was obviously an hardware problem. Solved by changing the power supply and removing a defective PCI network cardLeave a comment:
-
You should have a "control " array of 9 elements all initialized with 0.
Whenever you check any sudoku array (row, column or 3x3 square) you should first check that digit[i] is not equal (!=) to any of the elements of the control array (and the first will be for sure because they are still all zeroes), and subsequently fill the i-th element of the control array with the value of digit[i].
This way if the sudoku is valid,...Leave a comment:
No activity results to display
Show More
Leave a comment: