Improve reachable_moves generation by eliminating a function call