title: Best path in a grid
body: <p>I have a best path problem to solve.
  Given a nxn grid populated with walkable tiles and non walkable tiles, I have to reach point B from point A, through the shortest path.
  The trick is some of the walkable tiles contain points. To be a valid solution when I reach the goal I must have a certain number of points.
  The tiles have a variable number of points on them( or none) and I need the shortest path to reach the goal but to also have gathered at least M points on the way.</p>
  
  <p>What I have tried is the A* algorithm which finds the shortest path between the 2 points and tried to customize it to have the stop condition not just when it reaches the goal but to also have the necessary points. It doesn't work the way I made it because I am blocking the paths.</p>
  
  <p>If you have any suggestions how to approach this problem or another algorithm that would be more suited I would appreciate the help.
  Thanks.</p>