Alice Community (http://www.alice.org/community/index.php)
-   Works-In-Progress (http://www.alice.org/community/forumdisplay.php?f=14)
-   -   Bottles of Pop? (http://www.alice.org/community/showthread.php?t=12030)

 jkidd 06-27-2018 06:48 PM

Bottles of Pop?

Hey guys -

I'm trying to make a character in my Alice world sing the "99 Bottles of Pop" song.

I'm needing to use as few statements as possible. Wouldn't I use either the "loop" or "while" statements to do this?

Here is a screen shot of my method in Alice: [URL="https://image.ibb.co/mJRS28/Pop1.jpg"]https://image.ibb.co/mJRS28/Pop1.jpg[/URL]

What am I doing wrong? I guess I'm not good at this, as it is confusing to me. :/

- jkidd

 mandapanda625 07-06-2020 07:38 AM

Bottles Of Pop

I wonder if in this case you could use recursion. You can keep calling the same method as many times as needed until the task is completed. You wouldn't have to use the loop method and "count" how many bottles of pop are on the wall. I'm not the best at this but its just a thought. Maybe you can set it to recall that method multiple times until the song is over. Hopefully this helps, if it makes sense?

 djslater107 07-06-2020 02:18 PM

Bottles of pop

You are setting a bottles variable to the value of 100 - index
But you are not using that variable in the lyrics you are displaying and so, as near as I can tell you will be displaying

"bottles of pop on the wall"
"bottles of pop"
"bottles of pop on the wall"

without the actual number

you want to use join together world function

bottles + "bottles of pop on the wall"

Don Slater
Alice Project

 All times are GMT -5. The time now is 12:51 AM.

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