optimization: call getMovesFor only once