Seems pretty easy, you just need to check every possible direction for valid moves based on the dice. Eg. if you rolled 3 you first check if you can move up, down, let, right (down only valid move), then check all valid spaces for up/down/left/right move (again down is the only valid move), then we do our final check (since we rolled 3) and check all valid moves from the previous step for up/down/left/right (with left/right/down being valid). You may also want the person not to go backward (move to a previous space it was before) so you would need to make this an invalid move even though it is green.