Library tutorials & articles
AI 1 - Problem Solving (Artificial intelligence)
Conclusion
As I said earlier, I would recommend you read through the source code in this tutorial, then download the zip file, open it with Visual c++, and see the thing in action.
Because of the size of the example program, I'm guessing that you havent followed it 100%. And it looks much much more complicated that it atually is.
To code your own ai program all you need is:
- A method of storeing States
- A method for expanding states
- A way of tracing back to the initial state
- A way of sorting the states
- A function for scoreing a state.
- And a main loop that removes 1 state from a list, and puts its children onto the list.
Each of the above very easy for a comfortable c++ programmer. The difficult part is putting it all together and making it readable and understandable to others!
Related articles
Related discussion
-
conting repeated words
by Slicksim (2 replies)
-
Can somebody help: CAsyncSOcket class (Client-server networking)
by Mohammad Rastkar (3 replies)
-
custom progress bar in a datagridview with threading
by konikula (1 replies)
-
Calling C++ DLL from C#
by Thushan Fernando (1 replies)
Events coming up
-
Dec
6
Developing AJAX Web Applications with Castle Monorail
London, United Kingdom
Monorail is the model-view-controller engine of the Castle Project, bringing many of the best ideas of Ruby on Rails to the .NET world. In this talk, David De Florinier and Gojko Adzic show how Monorail makes it easy to develop .NET based AJAX applications, and how to use the Castle Project to build Web 2.0 applications effectively. Come to this session if you are a .NET web developer. Everyone is welcome!
i need help with an error im recieving.
i have a template linked list class
template <class LT>
class LList
{
private:
class LNode
{
public:
LNode ();
LT data;
LNode * next;
};
public:
LList();
LList( const LList & other);
~LList ();
LList & operator = (const LList & other);
bool operator == (const LList & other);
int Size() const;
friend ostream & operator << <> (ostream & outs, const LList<LT> & L);
bool InsertFirst (const LT & value);
bool InsertLast (const LT & value);
bool DeleteFirst ();
bool DeleteLast ();
private:
LNode * first;
int size;
};
and the friend function is giving me an error:
template <class LT>
ostream & operator << (ostream & outs, const LList<LT> & L)
{
if (L.first == NULL)
return outs;
outs << L.first -> data;
for (LList<LT>::LNode * n = L.first -> next; n != NULL; n = n -> next)
{
outs << ' ' << n -> data;
}
return outs;
}
i get an error at the for loop... the error is :
LLIST.tmp: In function
std:<img src="images/smilies/redface.gif" width=15>stream& operator<<(std:<img src="images/smilies/redface.gif" width=15>stream&, const LList<LT>&)': <br> LLIST.tmp:111: error:n' undeclared (first use this function)LLIST.tmp:111: error: (Each undeclared identifier is reported only once for each function it appears in.)
LLIST.tmp:33: error:
LList<int>::LNode*LList<int>::first' is private <br> LLIST.tmp:106: error: within this context <br> LLIST.tmp:33: error:LList<int>::LNode*LList<int>::first' is privateLLIST.tmp:109: error: within this context
application.cpp:19: instantiated from here
LLIST.tmp:33: error:
LList<int>::LNode*LList<int>::first' is private <br> LLIST.tmp:111: error: within this context <br> LLIST.tmp:111: error: dependent-nameLList<LT>::LNode' is parsed as a non-type, but instantiation yields a typeLLIST.tmp:111: note: say `typename LList<LT>::LNode' if a type is meant
i know these all have to do with friend and being private, what do i do?!?!
This thread is for discussions of AI 1 - Problem Solving (Artificial intelligence).