I made a pathfinder in Python that will show you how to go from point A to point B.
Here’s the code :
Enjoy! Here’s a map of the example house. Β Just type in the to and from points!



Published by


( I have been doing 3d for awhile now and have become skilled in both the worlds of 3d design and game development. As such, i have created a blog to show my artistic talent and share tutorials with others :)

12 thoughts on “Pathfinding!”

    1. Lol! It’s just generally easier to code IMO. Maybe my next bit will be C++ πŸ˜‰ How did I do with my layout? Or do you only look at .cpp files? πŸ˜›
      (for the record though, I did do some C++ scripting awhile ago)

      1. Scripting is usually running through a set of tasks consecutively. Programming generally refers to a “bigger picture” with non-linear code. e.g. when you start up Chrome, it doesn’t open a set of tabs, load them, and then shut down. πŸ˜›

      2. Oh, and I think people working with Unity refer to it as “scripting” because of the design pattern you use in Unity (Monobehaviors). Monobehaviors are scripts, essentially, that run every frame. Quite different from other design patterns. You can use regular .NET objects and stuff though.

  1. Stopsecret: “How did I do with my layout?”

    Let me be the judge of that, not Machine. πŸ˜› First, let’s see how it stacks up against PEP 8, a Python programmer’s best friend. I highly recommend reading it. It may seem limiting at first, but it actually makes coding a lot easier. πŸ™‚


    I’ve yet to run it (and I will) so the code review is incomplete, but here are the major issues.

    Never, never, use tabs. Always use 4-space indentation, per standard convention. Mixing tabs and spaces is even worse, and raises errors on Python 3! Also trim all excess whitespace from the ends of lines and blank lines. Performing these two simple actions reduced the number of PEP 8 errors from 187 to 130.
    In Python, semi-colons ( ; ) mean you are putting multiple statements on one line (which is generally discouraged (bullet point 4), not as an EOL (end-of-line) delimiter as in other languages. I understand the confusion. I am currently learning JavaScript, and I have having to put up with the constant use of braces (only used in Python to create dictionaries) and EOL semi-colon usage, and at times it can be maddening keeping it all straight! Removing all semi-colon usage further brought the PEP 8 errors down from 130 to 21, that more than 6 times less errors, over 8 times from the original script!

    There is way more I could point out in those 21 remaining errors, but I’ll try to save that for your next Python project, assuming you haven’t learned about those mistakes or you want me to point them before then. πŸ˜‰ You’re doing better since your last project, but there is always room for improvement, even in my coding.

    1. Fixed! Thanks for the critique πŸ™‚ As for the semicolons, I thought it was more comfortable, and if I switch back to other C types of coding, I’ll retain the habit instead of mentally trying to switch gears πŸ˜‰ I’m willing to face up to pep8 though. I like the online helper, cool site! πŸ˜›

      1. You can always keep adding the semicolons when coding but use Replace All to remove them before you publish, if that makes it any easier. Me, it is the opposite issue. I have to remember to add them in JavaScript, rather than remove them! Just remember it might (not saying will, but there is a chance) they can interfere with debugging. πŸ˜‰

        It is not hard to follow PEP 8, once you know it, that is. ;P There are still some things in it I am still working on, and keeping all lines to 80 characters is hard luck (unless I am completely misreading it). The style it outlines is really nice though. Makes for some clean code, and I have been taking that style and using it in JavaScript (good or bad I do not know, but I am anyway). πŸ™‚

Comments and feedback are appreciated :)

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s