🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

algorithms and data structures or classes

Started by
6 comments, last by Cherub 22 years, 8 months ago
Hi, When programming AI with C++, which part of C++ is more important ? Algorithms and Data Structures or Classes ?? Thank You, Cherub
Advertisement
Algorithms and data structures are the heart of any programming. Classes are just one way to go about doing that programming. Some OO-freaks focus too much on how code is packaged (in classes instead of a flat API, or something else...) and not enough on what that code actually does.

Object-orietned programming is something good, and is definately something youshould learn. But any class is going to contain algorithms and data structures; they, the "logic of coding" are much more fundamental than any "way of coding."
Thank You,

So...it is possible to do AI using classes, right ??

classes are just a language construct in OOP languages..

if you mean objects, certainly.

my advice is dont go too fancy on the OOP stuff because
you may forget about perfomance.

i once wrote a HMM model using C++ and a whole bunch of classes. The program was so bloated and slow because there was too much abstraction built into it .

i finally broke it down into smaller modules and re-coded for speed..

ended up still taking 6 hours to run, but i learnt a lessons..
OOP is very good to learn, but dont over do it .

{ Stating the obvious never helped any situation !! }
So...if I want to learn AI, you advise me to concentrate more on Algorithms and Data Structures, right ?
Whether you use objects or not to do AI calculations you still need to know how to manage your data (data structures), and how to manipulate that data (algorithms).

In other words, you will have to learn about data structures and algorithms regardless of how you intend to implement them (OOP, procedural, functional, etc).
quote: Original post by Cherub
Hi,

When programming AI with C++, which part of C++ is more important ? Algorithms and Data Structures or Classes ??

Thank You,
Cherub


That question really sounds like you don''t know much at all about C++. There isn''t a part of a language that''s more important for such a geneal task as "programming AI". Of course you need data structures, to store data, and "needing algorithms" is practically saying "needing code".

Here''s a couple of good books to read cover to cover a few dozen times

C++ Programming Language by Bjarne Stroustrup is really _the_ reference for C++. Of course, there''s plenty of other good books, too, and lots of info on the net.

The C++ FAQ book may be good (I haven''t got it yet) but the website at http://www.parashift.com/c++-faq-lite/ has a whole pile of useful info as well.

Design Patterns (Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides) is probably one of the most important "how to do OOP" books available - I''ld happily call it essential reading.


If you want to do any non-trivial AI programming, you probably also want to hunt down a decent AI book or two. There''s a list of books at http://www.flipcode.com/rotd/ that should help.

(if you can''t afford the hundreds of doallars worth of books that would be good remember that libraries are really useful places..)
quote: Original post by Cherub
So...if I want to learn AI, you advise me to concentrate more on Algorithms and Data Structures, right ?


As I''ve recommended to many in the past, data structures are one of the most important things to get a good handle on in class or on your own (if need be). A good data structure can improve the efficiency of your AI by two orders of magnitude, and thinking about how you''re going to organize the data will help you figure out how the AI is going to work too (at least it does for me).

Having said that, as another poster noted you''ll pick up a lot of this when you''re learning about C++ classes too, but I still recommend a separate class (or online course, or whatever) to really give the subject its due.




Ferretman

ferretman@gameai.com
www.gameai.com

From the High Mountains of Colorado

Ferretman
ferretman@gameai.com
From the High Mountains of Colorado
GameAI.Com

This topic is closed to new replies.

Advertisement