Alice Community  

Go Back   Alice Community > General Discussion > Questions and Comments

Reply
 
Thread Tools Display Modes
Assignment 6 - Loops
Old
shaolinkidd
Member
 
Status: Offline
Posts: 17
Join Date: Jul 2015
Default Assignment 6 - Loops - 07-28-2015, 01:59 PM

I recently completed this one. We had to make a character that sang the 99 bottles of pop song all the way down to 0. We were supposed to use a 'While' statement however I could not get that to work so I didn't use it and accomplished the same goal. If you did yours with the 'While' statement, I would like to know how you did it.
   
Reply With Quote
Old
MrMoke
Senior Member
 
MrMoke's Avatar
 
Status: Offline
Posts: 500
Join Date: Sep 2007
Location: Austin, Texas
Default 07-28-2015, 07:14 PM

Depending on the final verse either
While counter > 0
or
While counter >= 0
..sing
..dec the counter

Last edited by MrMoke; 07-28-2015 at 07:18 PM.
   
Reply With Quote
Old
CodeMan
Member
 
CodeMan's Avatar
 
Status: Offline
Posts: 36
Join Date: Aug 2013
Location: Northern Virginia
Default 07-28-2015, 08:04 PM

Quote:
Originally Posted by shaolinkidd View Post
I recently completed this one. We had to make a character that sang the 99 bottles of pop song all the way down to 0. We were supposed to use a 'While' statement however I could not get that to work so I didn't use it and accomplished the same goal. If you did yours with the 'While' statement, I would like to know how you did it.
Just curious how did you do it?


Im really RavenOfCode... shhhh....

Currently work on my first app :)
   
Reply With Quote
Old
Petit Suisse
Member
 
Status: Offline
Posts: 46
Join Date: Jul 2015
Default 07-30-2015, 02:42 AM

I'm also curious how you did it without a while statement. You're quite creative.

My solution:
http://gyazo.com/b08e6c0aa7b56d02a0fb3b09210ae065
   
Reply With Quote
loops
Old
shaolinkidd
Member
 
Status: Offline
Posts: 17
Join Date: Jul 2015
Default loops - 08-06-2015, 11:58 AM

Quote:
Originally Posted by CodeMan View Post
Just curious how did you do it?
I used a loop with a counter that incremented by 1 up to (but not including) 100 times
   
Reply With Quote
Assignment 6
Old
shaolinkidd
Member
 
Status: Offline
Posts: 17
Join Date: Jul 2015
Default Assignment 6 - 08-06-2015, 01:47 PM

Quote:
Originally Posted by shaolinkidd View Post
I used a loop with a counter that incremented by 1 up to (but not including) 100 times
See attached...
Attached Files
File Type: txt code.txt (997 Bytes, 12 views)
   
Reply With Quote
Assignment 6
Old
shaolinkidd
Member
 
Status: Offline
Posts: 17
Join Date: Jul 2015
Default Assignment 6 - 08-06-2015, 01:51 PM

https://gyazo.com/a466644d1a0ce42fb1ecbdfa29e16f03
   
Reply With Quote
Old
chickentree
Super Moderator
 
Status: Offline
Posts: 210
Join Date: Dec 2012
Location: Frosno, Ca
Default 08-06-2015, 03:37 PM

Quote:
Originally Posted by shaolinkidd View Post
ndx = 99
while ndx > 0
Do all your singing stuff
ndx=ndx-1
stuff to do after the song has ended.

When you get to 1 it will sing about one bottle of soda and decrement ndx to 0 at which point the while loop will exit
Note: for testing I would make ndx=3 and make sure everything works then change it to 99 before you submit it.

Mark


Mark Henwood
mhenwood@ieee.org
   
Reply With Quote
Old
noface0711
Junior Member
 
noface0711's Avatar
 
Status: Offline
Posts: 6
Join Date: Mar 2016
Default 03-23-2016, 08:11 AM

I'm also curious how you did it without a while statement. You're quite creative.
   
Reply With Quote
Old
RavenOfCode
Senior Member
 
RavenOfCode's Avatar
 
Status: Offline
Posts: 407
Join Date: Oct 2013
Location: Northern Virginia
Default 03-23-2016, 03:54 PM

Quote:
Originally Posted by shaolinkidd View Post
See attached...
I see, not the way I would do it but it works.


Stuff + Other Stuff + Different Other Stuff = Things :)

My best Alice game:

Clash of the Cubes (an arena fighting game):
http://www.alice.org/community/showthread.php?t=10738&highlight=game
   
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 ©2017, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.