From 2261ffa0ecbc213eaa8a598b0c9da3925bb64bbf Mon Sep 17 00:00:00 2001 From: zedarider Date: Thu, 8 Sep 2016 02:23:30 +0200 Subject: removing files --- .gitignore | 3 -- Makefile | 38 ---------------- bin/Sudoku_Solver | Bin 92504 -> 0 bytes build/main.o | Bin 35480 -> 0 bytes build/sudoku_solver.o | Bin 88704 -> 0 bytes include/sudoku_solver.hpp | 47 -------------------- resources/grid.txt | 9 ---- src/main.cpp | 12 ------ src/sudoku_solver.cpp | 107 ---------------------------------------------- 9 files changed, 216 deletions(-) delete mode 100644 .gitignore delete mode 100644 Makefile delete mode 100755 bin/Sudoku_Solver delete mode 100644 build/main.o delete mode 100644 build/sudoku_solver.o delete mode 100644 include/sudoku_solver.hpp delete mode 100644 resources/grid.txt delete mode 100644 src/main.cpp delete mode 100644 src/sudoku_solver.cpp diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 7475d13..0000000 --- a/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -# ignore build and bin folders -bin/. -build/. diff --git a/Makefile b/Makefile deleted file mode 100644 index a9372d5..0000000 --- a/Makefile +++ /dev/null @@ -1,38 +0,0 @@ -CC := g++ # this is the main compiler -# CC := clange --analyze # and comment out the linker last line -SRCDIR := src -BUILDDIR := build -TARGETDIR := bin -TARGET := bin/Sudoku_Solver - -SRCEXT := cpp -SOURCES := $(shell find $(SRCDIR) -type f -name "*.$(SRCEXT)") -OBJECTS := $(patsubst $(SRCDIR)/%,$(BUILDDIR)/%,$(SOURCES:.$(SRCEXT)=.o)) -CFLAGS := -g -std=c++14 -Wall -LIBDIR := -LIB := -INC := -Iinclude/ - -$(TARGET): $(OBJECTS) - @echo " Linking..." - @mkdir -p $(TARGETDIR) - @echo " $(CC) $^ -o $(TARGET) $(LIBDIR) $(LIB)"; $(CC) $^ -o $(TARGET) $(LIBDIR) $(LIB) - -$(BUILDDIR)/%.o: $(SRCDIR)/%.$(SRCEXT) - @echo " Building..." - @mkdir -p $(BUILDDIR) - @echo " $(CC) $< $(CFLAGS) $(INC) -c -o $@"; $(CC) $< $(CFLAGS) $(INC) -c -o $@ - -clean: - @echo " Cleaning..." - @echo " $(RM) -r $(BUILDDIR) $(TARGET)"; $(RM) -r $(BUILDDIR) $(TARGET) - -# Tests -tester: - @echo " $(CC) $(CFLAGS) test/tester.cpp $(INC) $(LIB) -o bin/tester"; $(CC) $(CFLAGS) test/tester.cpp $(INC) $(LIB) -o bin/tester - -# Spikes -ticket: - @echo " $(CC) $(CFLAGS) spikes/ticket.cpp $(INC) $(LIB) -o bin/ticket"; $(CC) $(CFLAGS) spikes/ticket.cpp $(INC) $(LIB) -o bin/ticket - -.PHONY: clean diff --git a/bin/Sudoku_Solver b/bin/Sudoku_Solver deleted file mode 100755 index 4680ec7..0000000 Binary files a/bin/Sudoku_Solver and /dev/null differ diff --git a/build/main.o b/build/main.o deleted file mode 100644 index 998ec51..0000000 Binary files a/build/main.o and /dev/null differ diff --git a/build/sudoku_solver.o b/build/sudoku_solver.o deleted file mode 100644 index 632ff1a..0000000 Binary files a/build/sudoku_solver.o and /dev/null differ diff --git a/include/sudoku_solver.hpp b/include/sudoku_solver.hpp deleted file mode 100644 index c3a685b..0000000 --- a/include/sudoku_solver.hpp +++ /dev/null @@ -1,47 +0,0 @@ -/* - - -- -- -- - -- -- -- - -- -- -- - | 00 01 02 | 03 04 05 | 06 07 08 | - | 09 10 11 | 12 13 14 | 15 16 17 | - | 18 19 20 | 21 22 23 | 24 25 26 | - | -- -- -- - -- -- -- - -- -- -- | - | 27 28 29 | 30 31 32 | 33 34 35 | - | 36 37 38 | 39 40 41 | 42 43 44 | - | 45 46 47 | 48 49 50 | 51 52 53 | - | -- -- -- - -- -- -- - -- -- -- | - | 54 55 56 | 57 58 59 | 60 61 62 | - | 63 64 65 | 66 67 68 | 69 70 71 | - | 72 73 74 | 75 76 77 | 78 79 80 | - -- -- -- - -- -- -- - -- -- -- - - */ - -#ifndef SUDOKU_SOLVER_HEAD -#define SUDOKU_SOLVER_HEAD - -#define GRIDSIZE 9 -#define SEPSIZE 3 - -#include -#include -#include -#include -#include - -class SudokuSolver { -public: - SudokuSolver(); - ~SudokuSolver(); - - void printGrid(); - bool checkBox(unsigned int &grid_location, std::vector &curr_grid); - bool checkRow(unsigned int &grid_location, std::vector &curr_grid); - bool checkColumn(unsigned int &grid_location, std::vector &curr_grid); - int getBox(unsigned int grid_location); -protected: -private: - std::vector grid; - std::ifstream grid_file; -}; - -#endif diff --git a/resources/grid.txt b/resources/grid.txt deleted file mode 100644 index d888b9d..0000000 --- a/resources/grid.txt +++ /dev/null @@ -1,9 +0,0 @@ -5 3 0 0 7 0 0 0 0 -6 0 0 1 9 5 0 0 0 -0 9 8 0 0 0 0 6 0 -8 0 0 0 6 0 0 0 3 -4 0 0 8 0 3 0 0 1 -7 0 0 0 2 0 0 0 6 -0 6 0 0 0 0 2 8 0 -0 0 0 4 1 9 0 0 5 -0 0 0 0 8 0 0 7 9 diff --git a/src/main.cpp b/src/main.cpp deleted file mode 100644 index 23009a7..0000000 --- a/src/main.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "../include/sudoku_solver.hpp" - -using namespace std; - -int main(int argc, char** argv) { - cout << "Sudoku Solver v1.1" << endl << endl; - - SudokuSolver solver; - - solver.printGrid(); - return 0; -} diff --git a/src/sudoku_solver.cpp b/src/sudoku_solver.cpp deleted file mode 100644 index 54888b8..0000000 --- a/src/sudoku_solver.cpp +++ /dev/null @@ -1,107 +0,0 @@ -#include "../include/sudoku_solver.hpp" - -using namespace std; - -SudokuSolver::SudokuSolver() { - int tmp_int; - grid_file.open("/home/yannherklotz/Github/sudoku_solver/resources/grid.txt", ios::in); - - if(grid_file.is_open()) { - cout << "File successfully opened..." << endl << endl; - } else { - cout << "Failed to open file..." << endl << endl; - exit(EXIT_FAILURE); - } - - while(grid_file >> tmp_int) { - grid.push_back(tmp_int); - } -} - -SudokuSolver::~SudokuSolver() { - -} - -void SudokuSolver::printGrid() { - int count = 0; - int row = 0; - int sep_count = 0; - for(int box : grid) { - cout << box << " "; - ++count; - - if(count % SEPSIZE == 0 && count % GRIDSIZE != 0) { - cout << "| "; - } - - if(count >= GRIDSIZE) { - count = 0; - cout << endl; - ++row; - } - - if(row >= SEPSIZE && sep_count < SEPSIZE-1) { - for(unsigned int i = 0; i < GRIDSIZE + SEPSIZE-1; ++i) { - cout << "- "; - } - cout << endl; - - row = 0; - ++sep_count; - } - } -} - -bool SudokuSolver::checkBox(unsigned int &grid_location, vector &curr_grid) { - int box_location = getBox(grid_location); - - for(unsigned int i = 0; i < curr_grid.size(); ++i) { - if(getBox(i) == box_location && grid_location != i) { - if(curr_grid[grid_location] == curr_grid[i]) { - return false; - } - } - } - - return true; -} - -bool SudokuSolver::checkRow(unsigned int &grid_location, vector &curr_grid) { - int row = grid_location / GRIDSIZE; - - for(unsigned int i = 0; i < curr_grid.size(); ++i) { - int tmp_row = i / GRIDSIZE; - if(row == tmp_row && grid_location != i) { - if(curr_grid[grid_location] == curr_grid[i]) { - return false; - } - } - } - - return true; -} - -bool SudokuSolver::checkColumn(unsigned int &grid_location, vector &curr_grid) { - int column = grid_location % GRIDSIZE; - - for(unsigned int i = 0; i < curr_grid.size(); ++i) { - int tmp_col = i % GRIDSIZE; - if(column == tmp_col && grid_location != i) { - if(curr_grid[grid_location] == curr_grid[i]) { - return false; - } - } - } - - return true; -} - -int SudokuSolver::getBox(unsigned int grid_location) { - int column = grid_location % GRIDSIZE; - - int box_row = grid_location / (GRIDSIZE * SEPSIZE); - int box_column = column / SEPSIZE; - - int box_location = box_row * 3 + box_column; - return box_location; -} -- cgit