generated from Trianta/cpp-unity-template
Finished project #1
@ -1,5 +1,5 @@
|
|||||||
add_executable(sudoku
|
add_executable(sudoku
|
||||||
|
./sudoku_solver.cpp
|
||||||
./sudoku.cpp
|
./sudoku.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(sudoku PUBLIC ${CMAKE_CURRENT_LIST_DIR})
|
|
||||||
|
@ -1,7 +1,47 @@
|
|||||||
|
#include "sudoku.hpp"
|
||||||
|
#include <fstream>
|
||||||
#include <iostream>
|
#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
21
src/sudoku.hpp
Normal 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
5
src/sudoku_solver.cpp
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#include "sudoku.hpp"
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user