Exercise: Number guessing in sub

Take the solution of the improved number guessing game
from examples/arrays/number_guessing.pl
and change it so some parts of it will be functions.

Specifically you can create subs for
1) the moving of the spaceship
2) checking the hit
   How would you indicate the need to 'last' from within the function?