In the past few months, I have had a growing interest in the game of sudoku. A big part of that is from a youtube channel called cracking the cryptic and if you are interested in puzzles I would recommend checking them out. But as I have become more interested in these puzzles I have felt my mindset shift in other aspects of my life as well. I recently graduated from a coding Bootcamp and therefore have been doing quite a bit of coding and want to highlight some of the areas that I think repeated puzzle-solving has affected the way I approach writing code.
One thing that has become clear to me is that almost all problems have more than one right answer. If you know anything about sudoku you’re probably thinking that it’s quite silly to deduce that from sudoku puzzles, seeing as they have only one correct solution. That's true, however, I have realized that many times there is more than one way to get to that correct solution. I think as a new programmer I get hung up a lot on looking for a way to write the code that takes up the fewest lines or runs the fastest. Those are good things to learn, but they tend to slow down my process and distract me from what's really important, and that's writing code, letting it be ugly or wrong, and learning from it. As a new programmer I think one of the most critical parts of learning is doing it your way, and figuring it out on your own. If you're interested to know the best way look it up after you have found one solution or one path to the solution if there is only one. If you get really stuck try to find a hint that doesn’t just take you to the answer, but instead gets you past the wall and leaves you with more to learn.
Another thing that sudoku has helped me with is my thoroughness in checking my code. It’s important in sudoku to check your logic and think of things that could break the puzzle. If you miss something early on and place a number where it can’t go it can be a HUGE headache down the road when you find out you’ve made a mistake. This mindset has helped me explore all the different ways a program could fail and check to make sure I’m handling those situations. Writing good tests and having good error handling is something I have gotten much better at since I have started the puzzles.
Sudoku is a very systematic game, and that has transfered to how I write code. Early on in learning to code I often would start a project by coding. Many times I wasn’t even sure what I wanted an app or feature to do before I started coding it and although I usually figured it out in the end it makes the road to the finish and even the finished product messy and hard to continue to work on. More recently I have started to think about projects logically and consider what steps are the most appropriate to take. My finished products come out looking cleaner and the path there is void of some of the stresses that used to be present with my former style.
I hope I gave you a few things to think about and maybe inspired you to try a few sudoku puzzles yourself. If I did I will leave one of the puzzles I most enjoyed recently here for you to try out! It’s rather tricky but keep at it, you’ve got this!!