TELLES0808
well, kinda depends on how your game will work, are you building a two (or more) player game and want to show/highlight possible moves, or suggest the best possible move? give a hint? Or have a player play against the computer and build an AI that will be able to play the game by itself?
the logic would go something like:
specify a start block (and possibly a target block) - then if you are rolling dice, calculate all possible moves and the benefit of each move, sort them and pick the best move. Or if it is just a matter of deciding how far you can move for a specific cost, or how far you can move without making units vulnerable, then factor that into the cost/benefit of each possible move, collect the results in an array as they are calculated, sort and pick the move with the best result.
A human can glance at a board like that and rule out most of the inefficient moves instantly. A computer needs to brute force calculate every move to know what to do.