I'm making a little game where I'm going to have a character on a grid that moves around. I was going to use Dijkstra's algorithm for the pathing as they move around. Only problem being is I want to make thin walls(instead of just removing nodes) like so: http://i.gyazo.com/85d110c17cf027d3ad0219fa26938305.png
I was thinking the best way to do it was just edit the edge weights between 2 squares to be so high that it would never be crossed. Anyway, onto the question:
What is the most efficient way to assign edge weights to each connection in the grid?
I've thought about using an adjacency matrix, but for a 15x6 grid, that's a 90x90 matrix which seems... excessive. Any help would be nice, thanks (:
I agree with rocky's answer - just store the weights for the four directions for each square in an array (each array element will be a struct/tuple which contains the four weights). To look up an edge between two arbitrary squares, you first check if they are adjacent, and if so use the appropriate weight from the array. Not sure why anyone mentioned adjacency lists or matrix, which are redundant here.