Thread: Lab 2
View Single Post
Lab 2
Old
JoshuaWilson
Junior Member
 
Status: Offline
Posts: 6
Join Date: Sep 2018
Default Lab 2 - 10-13-2018, 07:08 PM

At first, I thought I knew that I was going to do on Lab 2. Once I opened it up, my plans changed completely. I realized that the best way to do it was to create a recursive function (that is, a function with a function call within the function) so that a function can call itself at its end to restart the cycle.

After experimenting a while with other methods, this was the best I could think of. I used 3 functions, one to jump + spin, one to initialize the world, and a third for everything else (asking for number of spins, etc.). Inside of the third function, I used a function call so that if the user chooses they may re-run the main section of the program without restarting the entire program.
   
Reply With Quote