Skip to content

Instantly share code, notes, and snippets.

@rharriso
Last active April 29, 2017 03:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rharriso/55ae58fa4dbab849e6016311690c98fc to your computer and use it in GitHub Desktop.
Save rharriso/55ae58fa4dbab849e6016311690c98fc to your computer and use it in GitHub Desktop.
using cellQueue = queue<shared_ptr<SudokuCell>>;
class SudokuBoard {
cellQueue cells;
public:
// initialize board
SudokuBoard(){/* ... */}
// fill the board with valid solution
void fillCells(){/* ... */}
// take index and return 2d coord
coord resolveIndex(int index) {
return coord{
index / SIZE,
index % SIZE
};
}
//Take coord and return index
int resolvePosition(const coord &position) {
return position.i * SIZE + position.j;
}
// get cell by index
shared_ptr<SudokuCell> at(int index) {/* ... */}
// get cell by coord
shared_ptr<SudokuCell> at(coord position) {/* ... */}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment