This is what I got from @griffpath 's episode 2 of his tutorial.
Thanks @griffpatch for helping me code. Note: If you go to the last stage and you try to pass you will have to try to go back the same amount to go to the previous stage.