Hi, welcome back for an English blog entry. I will be writing about stuff I coded in last moths and I think some of them will be useful for anyone interested in learning about the Linux kernel, Linux system programming or C++/STL.
Well, I wrote some code which finds the exit of a 2d maze by
using a stack, back when I saw a problem in the
Larry Nyhoff's book. One
can call it some sort of "depth-first search". Then I enhanced it to
find the shortest path possible. You can read its code
on GitHub. It's
very crude and may be inefficient but I was just beginning to use C++
back then.
So I later found out (in the same book) that shortest paths can
be found much more easily by using breadth-first search on a directed
graph (namely
Dijkstra's method). And I set off to write my own digraph
class right away. Well, it took more time than I anticipated but more on
that below.
Finally I want to say writing a digraph class/container helped me see how the design process is important. Also I realized I had the whole encapsulation principle wrong in OOP. It took time but it was well worth it. Unfortunately some parts are a little cryptic but it works alright.
You can get the
source from GitHub.