Alice Community  

Go Back   Alice Community > General Discussion > The Lounge

Reply
 
Thread Tools Display Modes
Lab 2
Old
JoshuaWilson
Junior Member
 
Status: Offline
Posts: 6
Join Date: Sep 2018
Default Lab 2 - 10-13-2018, 06: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
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Copyright ©2018, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.