Pathfinding algorithm implementation

Hi all,

I read about this pathfinding algorithm and decided to try and figure out a way to do it
Now I haven’t looked up the actual algorithm, so I might be doing some weird or unlogical things; my main goal was to come up with a solution myself and not just implement it. If anyone feels like having a look at how it’s done and has tips, I’d be happy to try them out!

Here’s the code and here’s a screenshot:
[edit] It’s not automated so every step is manual: ‘space’ to generate a new grid, ‘c’ to calculate cost step, ‘s’ to move 1 step closer to the goal.