Have I told you that I am still a student? Fortunatly, it's easter holidays now :) So I have time to do anything I want, and that's usually programing and starting (unfortunatly not finishing) ambitious projects. During the last weeks I spent my time trying to make simple 2D games, studying new data structures and algorithms and learning assembly. I am not making much progress with assembly, I am more fond of high-level programing. As for game developing, until now I have done a Tic-Tac-Toe and a Pacman game using SDL. I might upload them later so you can take a look. Now I am in the process of making a Real Time Strategy game. Yes! And it's way more complex than I thought, but it has a lot of AI and that keeps me motivated.
Yesterday while implementing the A* algorithm, it took me ~30 minutes to figure out why the following line of C++ code was not working (I don't remember the exact compiler error) :
std::list<*Node> OpenList;
Node is a class and OpenList should be a list of pointers to Node classes.
Have you noticed the mistake yet? DON'T GOOGLE IT, DON'T CHEAT! (you won't find anything anyway, I tried) Come on, it's 1 line of code!
Changing the line to
std::list<Node* > OpenList;
was enough :)
Of course I knew that the * should come after the type specifier, but why didn't I think of it the first time? Pah, who cares. I've fixed it now and I won't make the same mistake again.
Δεν υπάρχουν σχόλια:
Δημοσίευση σχολίου