I am currently trying to create an algorithm for a piece to move any number of sqaures in any set direction (similar to a rook in chess) but each square is allocated a value based on it's quality of positioning.
I want the piece to move to the lowest value available square at each time-step, is there any way of completing this?