Hi everyone. I'm working on a project - a "sudoku solver." I'm not very well-trained, never taken a C++ class or anything, but have been slowly picking things up on my own. Although I'm starting to learn more and more elements of C++, I'm most familiar with the basics, recursion, arrays and vectors. (Lists, heaps, piles, deques, etc confuse me, along with the whole object-oriented class system. I'll get there soon hopefully).
My approach:
Create a nine by nine array, and link each specific position to a "list" or set of the digits 1-9. Visually, I'm seeing a 2D game-board, with a "stack" of possible numbers on each space. I figured if I can set this up, some type of brute force would lead to answer.
The question:
Is there a way to link the 81 positions on the board to a list or vector sequence of digits? I know I could declare 81 variables by hand, and have them store the possible digits, and go from there... but I feel like there has to be a more sophisticated way.
Is there a way to have an array thats joined to a list? Like
"array[position][position]*[list of 9 numbers]*"?
There certainly is. Make an array of lists or make an array of vectors or make an array of arrays..
I'm not certain this is a good approach though. One 'cell' of a Sudoku puzzle has either one number in it or none. Making use of an array of int (either 1 or 2d) you could use the value at each particular position to store whether a position currently has a number (0 = no number?) and what that number is.