Preparation work

This commit is contained in:
Trianta 2023-10-21 17:03:59 -05:00
parent d35bd25e28
commit b7217dc877
4 changed files with 71 additions and 5 deletions

View File

@ -1,5 +1,5 @@
add_executable(sudoku
./sudoku_solver.cpp
./sudoku.cpp
)
target_include_directories(sudoku PUBLIC ${CMAKE_CURRENT_LIST_DIR})

View File

@ -1,7 +1,47 @@
#include "sudoku.hpp"
#include <fstream>
#include <iostream>
#include <string>
Sudoku::Sudoku(void) {
board.resize(9, std::vector<int>(9, -1));
}
void Sudoku::FillBoard(std::string filePath) {
std::ifstream sudokuFile(filePath);
if (!sudokuFile) {
std::cerr << "Error opening file: " << filePath << std::endl;
exit(1);
}
std::string line;
while (!sudokuFile.eof()) {
sudokuFile >> line;
std::cout << line << std::endl;
}
}
void Sudoku::Solve(void) {
}
bool Sudoku::IsBoardSolved(void) {
return true;
}
bool Sudoku::IsRowComplete(int row) {
return true;
}
bool Sudoku::IsColumnComplete(int column) {
return true;
}
std::vector<int> Sudoku::GetUnusedInRow(int row) {
}
std::vector<int> Sudoku::GetUnusedInColumn(int column) {
int main(void) {
std::cout << "Sudoku started" << std::endl;
std::cout << "Sudoku ended" << std::endl;
return 0;
}

21
src/sudoku.hpp Normal file
View File

@ -0,0 +1,21 @@
#ifndef SUDOKU_HPP
#define SUDOKU_HPP
#include <string>
#include <vector>
class Sudoku {
public:
Sudoku(void);
std::vector< std::vector<int> > board;
void FillBoard(std::string filePath);
void Solve(void);
bool IsBoardSolved(void);
private:
bool IsRowComplete(int row);
bool IsColumnComplete(int column);
std::vector<int> GetUnusedInRow(int row);
std::vector<int> GetUnusedInColumn(int column);
};
#endif

5
src/sudoku_solver.cpp Normal file
View File

@ -0,0 +1,5 @@
#include "sudoku.hpp"
int main(void) {
return 0;
}