#ifndef _TREENODE_H
#define _TREENODE_H
#define SIZE 9
class TreeNode{
public:
UINT fn, gn, hn; //For A* algorithm use.
UINT h; //Heuristic value.
char state[SIZE]; //Current puzzle state.
TreeNode* parent;
TreeNode* child1;
TreeNode* child2;
TreeNode* child3;
TreeNode* child4;
TreeNode(){
parent=NULL;
child1=NULL;
child2=NULL;
child3=NULL;
child4=NULL;
}
void setState(char *p){
for(int v=0; v<SIZE; v++) state[v]=*(p+v);
}
};
#endif
CORE SOURCE CODE solving 8 Puzzle AI problems written in MS Visual MFC C++.
COMPLETE Full set of working SOURCE CODE for the working MFC C++ program, SPEED UP your learning process,
just 4.99 USD. Email / Paypal to ahyeek@gmail.com
Full working program can be downloaded to TRY out: AI 8-puzzle (8 Puzzle) solver
Friday, May 9, 2008
8 Puzzle Code - TreeNode.h
First of all, we create a TreeNode class for storing puzzle state. Below is the code store in TreeNode.h.
Subscribe to:
Post Comments (Atom)
1 comment:
The source code of "stdafx.h" is missing... The program cannot run... @.@
Post a Comment