diff --git a/cpp/NPuzzleSolverUtil.h b/cpp/NPuzzleSolverUtil.h index ee19325..b2a008b 100644 --- a/cpp/NPuzzleSolverUtil.h +++ b/cpp/NPuzzleSolverUtil.h @@ -20,30 +20,7 @@ #include #include - -class Node { - Node* parent; - std::vector< std::vector > state; - - int manhattan_distance; - - /* Position of the Blank spot */ - int x, y; - - public: - Node() {} - Node(Node* parent, - const std::vector< std::vector >&state, - int manhattan_distance) { - this->parent = parent; - this->state = state; - this->manhattan_distance = manhattan_distance; - } - - int get_manhattan_distance(); - Node* get_parent(); - void print_node(); -}; +#include class NPuzzleSolver { public: diff --git a/cpp/Node.cpp b/cpp/Node.cpp new file mode 100644 index 0000000..14d02f0 --- /dev/null +++ b/cpp/Node.cpp @@ -0,0 +1,19 @@ +/* + * Copyright 2017 Bytes Club + + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#include +#include "Node.h" \ No newline at end of file diff --git a/cpp/Node.h b/cpp/Node.h new file mode 100644 index 0000000..eb1ecc2 --- /dev/null +++ b/cpp/Node.h @@ -0,0 +1,47 @@ +/* + * Copyright 2017 Bytes Club + + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#ifndef CPP_NODE_H_ +#define CPP_NODE_H_ + +#include +#include + +class Node { + Node* parent; + std::vector< std::vector > state; + int manhattan_distance; + + /*Position of blank spot*/ + int x,y; + +public: + Node() {} + Node (Node* parent, + const std::vector< std::vector >& state, + int manhattan_distance) { + this->parent = parent; + this->state = state; + this->manhattan_distance = manhattan_distance; + } + + int get_manhattan_distance(); + Node* get_parent(); + void print_node(); +} + +#endif //CPP_NODE_H_ \ No newline at end of file