@vladimirkovalev1990 What you're suggesting is in fact quite impossible (you're right to suspect that), but that's by far not the only way to solve a puzzle. The way I tend to solve the puzzle is using the same method a human would do it: have the program go through all blank pieces and check to see if there is enough information to solve it. Keep checking them and solving pieces that have info until you finish. If it can't be solved this way then a human can't solve it either.
Jake, I had the same issue as you and was lucky enough to find a code sample (including islegal function). Google islegal buckland program The program compiles and works, though it doesn't seem to solve every puzzle, only puzzles which are very easy. I'm currently trying to figure out why. Love the videos, love the fact that I can actually now comprehend pointers and references. THANK YOU UNSW!
I'd use a deductive method to solve the puzzle. Start with nine times as many cells, with 1-9 repeating, counting each set of nine as the possible values for one cell and eliminate all impossible choices until only one remains.
Does anyone have the source for the worked out functions? I've been trying to program the isLegal() function and have been failing horribly, I got everything else worked out except that. The odd data structure we are using seems to complicate it instead of a multidimentional array. Maybe I'm just doing it wrong though, Feel free to message me to discuss or if you have the answer. Thanks! Btw, Great videos UNSW! This guy is great and fun to watch!
Amazing lecturer, Its a shame he's doing C, I'm having trouble with dynamic array of different objects in c++ (I know, I could use std::vector, but its for an assignment) this guy has such a passion and love for teaching, its awesome!
can we actually solve sudoku in reasonable time using this algorithm? I have built a program myself using this algorithm and as soon as I did so it struck me that if we start with a sudoku that has got no solutions e.g. 1,1,......... we will have to try out ALL(!) of the 9^79 combinations to be sure that it really is unsolvable. Therefore, I believe on average will take ages for the offered algorithm to solve a problem. Please correct me if I am wrong.
Ahoho! you are very wrong. 9*79 its all combination for empty sudoku with all degenerate possibility. (f.e if you have few same number "111234569"). Here you have only one solution with many defined cells.
Yeah, I really got into 21 BECAUSE of the high quality. I'm sort of immediately turned off with the low quality in this one. But I'll stick through it anyway nonetheless.
I do not understand why to teach pure C language as C++ is the advanced C and has all plus is more efficient. As Bjarne (creator of C++) says there is no benefit using C other than if you must do it like for example lack of C++ support. But if you start from the scratch a program there is no reason using C if you can use C++. Like here for example he must use #define s to define constants. In C++ it would be: const char MIN_VALUE = '1'; which is much better as there is compile time type checking. define s can give difficult bugs to trace. btw the latest C language does support const, which is good. But anyway in this video I think using #define is not a good idea.
Linus, my dear Finnish fellow :). Wow he is radical there! :). Ok, I might agree that in some tasks there is no need to use C++. Like I am currently programming a Gomuko game engine, in engine I do not really use C++... i have no reason really to use it- just use C there. But when implementing the user interface I surely use C++. And like Bjarne said, it is not true necessary that C is faster. Things can be done actually faster in many cases with C++ than with C because C++ uses machine level optimization in certain situations where C does not. So in a User interface programming C++ can be more efficient and even faster. Also If you need to use arrays which needs to automatically resize themselves C++ is propably faster there because it optimizes things which C is not doing. Bjarne has spoken in which situations C++ is faster than C, there is a video about it. Also, can you give me an example where C is faster than C++? Maybe we can test that on our compilers to see if its true. My understanding is that there is not many situations where that is true.
***** I actually do tutoring, 5 years now. I think, like Bjarne also, that learning C has a danger of learning wrong programming habbits. I cannot prove am correct, but thats how I think currently. C++ makes more safe code imo, so I want to teach people who mostly do high level coding anyway to learn to make safe/reusable and easy to modify code. So imo its better to teach straight away C++ than C. But because C is a subset of C, it does not hurt teaching basics of C first. But when it comes how to do professional programs, the full program, then I prefer C++.
***** Faster? you mean the code runs faster with define? We can surely test that. I would guess its not faster... But sure, safety is more important anyway even if its faster. Can you show me a code example where define beats const, I ll double check it? No, I definitely think using define here is wrong, its not even a guestion about opinion here... I teach students its wrong! Well, you can disagree with me.... but I have my opinions:).
***** oh so you talking about that compiling the code is slower, then the actual run? I though you meant the program runs slower. But even if the compiling is a bit slower, I do not think its a significant issue/difference as there are not so many constants in a code.
Ye but i was talking about the running the program itself, not the compilation process. After compiling the program you run the program. Then it does not matter if its define or const... they both are equally fast
What a mouthy crowd. They should appreciate having such an awesome professor.
"I won't stick it in if it's not legal!"
Good idea!
12:30 - "The most important thing is working out what is the most important thing."
tell me its not
man he's good!
i have been watching Richard's video for a whole day.
wish i can download it instead of on youtube...
@vladimirkovalev1990
What you're suggesting is in fact quite impossible (you're right to suspect that), but that's by far not the only way to solve a puzzle. The way I tend to solve the puzzle is using the same method a human would do it: have the program go through all blank pieces and check to see if there is enough information to solve it. Keep checking them and solving pieces that have info until you finish. If it can't be solved this way then a human can't solve it either.
Jake,
I had the same issue as you and was lucky enough to find a code sample (including islegal function).
Google islegal buckland program
The program compiles and works, though it doesn't seem to solve every puzzle, only puzzles which are very easy. I'm currently trying to figure out why.
Love the videos, love the fact that I can actually now comprehend pointers and references. THANK YOU UNSW!
I'd use a deductive method to solve the puzzle. Start with nine times as many cells, with 1-9 repeating, counting each set of nine as the possible values for one cell and eliminate all impossible choices until only one remains.
Does anyone have the source for the worked out functions? I've been trying to program the isLegal() function and have been failing horribly, I got everything else worked out except that. The odd data structure we are using seems to complicate it instead of a multidimentional array. Maybe I'm just doing it wrong though, Feel free to message me to discuss or if you have the answer.
Thanks! Btw, Great videos UNSW! This guy is great and fun to watch!
Amazing lecturer, Its a shame he's doing C, I'm having trouble with dynamic array of different objects in c++ (I know, I could use std::vector, but its for an assignment)
this guy has such a passion and love for teaching, its awesome!
i noticed that some of these are in HQ while others arnt will they all eventually be HQ? i cant read alot of the things on the screen :(
can we actually solve sudoku in reasonable time using this algorithm? I have built a program myself using this algorithm and as soon as I did so it struck me that if we start with a sudoku that has got no solutions e.g. 1,1,......... we will have to try out ALL(!) of the 9^79 combinations to be sure that it really is unsolvable. Therefore, I believe on average will take ages for the offered algorithm to solve a problem. Please correct me if I am wrong.
Ahoho! you are very wrong. 9*79 its all combination for empty sudoku with all degenerate possibility. (f.e if you have few same number "111234569"). Here you have only one solution with many defined cells.
Yeah, I really got into 21 BECAUSE of the high quality. I'm sort of immediately turned off with the low quality in this one. But I'll stick through it anyway nonetheless.
My favorite number system in a language, it goes like this: 1, 2, many. Yep, that's all the numbers.
HOW DO ALGORITHM?
@axelasdf I do think this idea may have some flaws.
Why do his students talk so much? If I was in this class, I'd be smacking people.
why subtitles are not up to the mark??
kind of annoying
I do not understand why to teach pure C language as C++ is the advanced C and has all plus is more efficient. As Bjarne (creator of C++) says there is no benefit using C other than if you must do it like for example lack of C++ support. But if you start from the scratch a program there is no reason using C if you can use C++.
Like here for example he must use #define s to define constants. In C++ it would be: const char MIN_VALUE = '1'; which is much better as there is compile time type checking. define s can give difficult bugs to trace. btw the latest C language does support const, which is good. But anyway in this video I think using #define is not a good idea.
Linus, my dear Finnish fellow :). Wow he is radical there! :). Ok, I might agree that in some tasks there is no need to use C++. Like I am currently programming a Gomuko game engine, in engine I do not really use C++... i have no reason really to use it- just use C there. But when implementing the user interface I surely use C++. And like Bjarne said, it is not true necessary that C is faster. Things can be done actually faster in many cases with C++ than with C because C++ uses machine level optimization in certain situations where C does not. So in a User interface programming C++ can be more efficient and even faster. Also If you need to use arrays which needs to automatically resize themselves C++ is propably faster there because it optimizes things which C is not doing. Bjarne has spoken in which situations C++ is faster than C, there is a video about it. Also, can you give me an example where C is faster than C++? Maybe we can test that on our compilers to see if its true. My understanding is that there is not many situations where that is true.
***** I actually do tutoring, 5 years now. I think, like Bjarne also, that learning C has a danger of learning wrong programming habbits. I cannot prove am correct, but thats how I think currently. C++ makes more safe code imo, so I want to teach people who mostly do high level coding anyway to learn to make safe/reusable and easy to modify code. So imo its better to teach straight away C++ than C. But because C is a subset of C, it does not hurt teaching basics of C first. But when it comes how to do professional programs, the full program, then I prefer C++.
***** Faster? you mean the code runs faster with define? We can surely test that. I would guess its not faster... But sure, safety is more important anyway even if its faster. Can you show me a code example where define beats const, I ll double check it? No, I definitely think using define here is wrong, its not even a guestion about opinion here... I teach students its wrong! Well, you can disagree with me.... but I have my opinions:).
***** oh so you talking about that compiling the code is slower, then the actual run? I though you meant the program runs slower. But even if the compiling is a bit slower, I do not think its a significant issue/difference as there are not so many constants in a code.
Ye but i was talking about the running the program itself, not the compilation process. After compiling the program you run the program. Then it does not matter if its define or const... they both are equally fast
Great lecturer but the camera guy gets a fail on this!!! FOCUS!!!
um this was hard..
shhhhhhhhhh ...
Waste of time. Blah, blah, blah. I’m sure he can program , but he wastes so much time. Then he wonders why people talk so much in his presence.