4 ms·
One of the first major programs I wrote was a Sudoku Solver in python. I learnt a lot from it, and looking back it had such horrible code. Probably the worst wa
by keeperofdakeys 14y ago
One of the first major programs I wrote was a Sudoku Solver in python. I learnt a lot from it, and looking back it had such horrible code. Probably the worst was the hard-coded row, column and square indexes for function calls. Somehow I couldn't think of an easy way to do it automatically at the time, but now it seems like the easiest thing in the world. There was also a point where I used "+" on all 81 elements as strings, which was rather slow. After using a ''.join(), it was much, much faster, because the join was one operation instead of 80 (for those that don't know python, join is simply a function that joins strings).
Ironically I also tried writing an object orientated version to learn C++, but that didn't get very far.