-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Node.h, Node.cpp: Added header file for class Node
Added Node.h to contain class declaration, constructor and method for class Node. Node.cpp yet to be filled pending clarification on implementation. Signed-off-by: Rohit Das <[email protected]>
- Loading branch information
Showing
3 changed files
with
67 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include <iostream> | ||
#include "Node.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#ifndef CPP_NODE_H_ | ||
#define CPP_NODE_H_ | ||
|
||
#include <vector> | ||
#include <iostream> | ||
|
||
class Node { | ||
Node* parent; | ||
std::vector< std::vector<int> > state; | ||
int manhattan_distance; | ||
|
||
/*Position of blank spot*/ | ||
int x,y; | ||
|
||
public: | ||
Node() {} | ||
Node (Node* parent, | ||
const std::vector< std::vector<int> >& 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_ |