summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzedarider <ymherklotz@gmail.com>2016-09-08 02:23:30 +0200
committerzedarider <ymherklotz@gmail.com>2016-09-08 02:23:30 +0200
commit2261ffa0ecbc213eaa8a598b0c9da3925bb64bbf (patch)
tree4b825dc642cb6eb9a060e54bf8d69288fbee4904
parentc9d951f0226b568c3c456a5aecc57bd9777a8441 (diff)
downloadsudoku_solver-2261ffa0ecbc213eaa8a598b0c9da3925bb64bbf.tar.gz
sudoku_solver-2261ffa0ecbc213eaa8a598b0c9da3925bb64bbf.zip
removing files
-rw-r--r--.gitignore3
-rw-r--r--Makefile38
-rwxr-xr-xbin/Sudoku_Solverbin92504 -> 0 bytes
-rw-r--r--build/main.obin35480 -> 0 bytes
-rw-r--r--build/sudoku_solver.obin88704 -> 0 bytes
-rw-r--r--include/sudoku_solver.hpp47
-rw-r--r--resources/grid.txt9
-rw-r--r--src/main.cpp12
-rw-r--r--src/sudoku_solver.cpp107
9 files changed, 0 insertions, 216 deletions
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
--- a/bin/Sudoku_Solver
+++ /dev/null
Binary files differ
diff --git a/build/main.o b/build/main.o
deleted file mode 100644
index 998ec51..0000000
--- a/build/main.o
+++ /dev/null
Binary files differ
diff --git a/build/sudoku_solver.o b/build/sudoku_solver.o
deleted file mode 100644
index 632ff1a..0000000
--- a/build/sudoku_solver.o
+++ /dev/null
Binary files 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 <string>
-#include <vector>
-#include <cstdlib>
-#include <fstream>
-#include <iostream>
-
-class SudokuSolver {
-public:
- SudokuSolver();
- ~SudokuSolver();
-
- void printGrid();
- bool checkBox(unsigned int &grid_location, std::vector<int> &curr_grid);
- bool checkRow(unsigned int &grid_location, std::vector<int> &curr_grid);
- bool checkColumn(unsigned int &grid_location, std::vector<int> &curr_grid);
- int getBox(unsigned int grid_location);
-protected:
-private:
- std::vector<int> 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<int> &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<int> &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<int> &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;
-}