can you help me please, i get a task about sudoku game 3x3 use 1 2 and 3 number, and the quantity of a row or a column is 6,
please help me yaaa, thank you
can you help me please, i get a task about sudoku game 3x3 use 1 2 and 3 number, and the quantity of a row or a column is 6,
please help me yaaa, thank you
You could use the brute force approach and just try all 6^3 = 216 possible permutations. Each row can only be one of 6 possible permutations:
Code:{1,2,3}, {1,3,2}, {2,1,3}, {2,3,1}, {3,1,2}, {3,2,1}
I'm the author of MiniBasic: How to write a script interpreter and Basic Algorithms
Visit my website for lots of associated C programming resources.
https://github.com/MalcolmMcLean
Apparently there are brute force solvers for real Sudoku, since the minimum number of filled in squares reduces the number of permutations, to one that a typical PC can solve reasonably quickly. Wiki article:
Sudoku solving algorithms - Wikipedia, the free encyclopedia
A simple solution is backtracking:
Keep filling the board with random numbers, as long as the rules are respected.
If the rules are broken ( no number fits ) then go back to the previous cell and try a different available number.
This algorithm is ( almost? ) always implemented using recursion.
Last edited by GReaper; 05-22-2013 at 11:25 AM.
Devoted my life to programming...
yes, i know the possible permutations, but i don't know the code in c
Code doesn't just appear, it is developed. Give a start and when you get stuck, post your attempt and you'll get more help. Nobody is going to hand you code (in case you missed it, you should read the homework policy).
I guess that this is an assignment for some sort of beginners programming course?
My advice is to sit down with pen and paper and try to construct a solution to this. You can't write a program unless you understand the problem at hand and how to solve it. Construct a pen and paper algorithm for solving this.
If it is for a programming course, then you actually should be able to complete this assignment. If you can't then you either have a bad instructor or you have been slacking in class.
Feel free to come back with specific questions when you start to develop a solution. We are happy to help you when you have some code to show.
Good luck.
Imagine the following being posted on a novellist's forum:
"can you help me please, i want to write a book about a political thriller using three characters and some plot twists
please help me yaaa, thank you"
"yes, i know it would involve writing in proper grammar, but i don't know the how to write in English".
Just how far do you think you'd get? And would you honestly expect someone to just write the book for you and give it to you?
- Compiler warnings are like "Bridge Out Ahead" warnings. DON'T just ignore them.
- A compiler error is something SO stupid that the compiler genuinely can't carry on with its job. A compiler warning is the compiler saying "Well, that's bloody stupid but if you WANT to ignore me..." and carrying on.
- The best debugging tool in the world is a bunch of printf()'s for everything important around the bits you think might be wrong.
You should look around on youtube, It was done by a professor at an austrailian college. I think it was divided up over 2 one hour videos. Goodluck with your search.
char [9];