fix generateForwardMoves function