Alice Community

Alice Community (http://www.alice.org/community/index.php)
-   How do I...? (http://www.alice.org/community/forumdisplay.php?f=16)
-   -   Beginner problem (http://www.alice.org/community/showthread.php?t=8176)

Highmountain 03-04-2012 05:20 PM

Beginner problem
 
1 Attachment(s)
Hi,
So, I'm working my way through a book for absolute beginners in programming (which teaches objective-c, but also starts out with some Alice). I started four days ago, so I'm Really new at this :)
Right now, I'm doing a simple program in Alice 3.0 Beta that creates a random number and then makes the player guess the number. When the player has guessed right I have a boolean that asks if the player wants to play again, and the player can then click on true or false and then OK.

I have been trying to make that choice look better. To have it say, "play again? Y / N". So the player can write Y or N to play again or not.

But I realise this won't work with boolean or integer, since they only use numbers, right? I tried using getStringFromUser, and I got a box where I could write Y or N, but in the code I couldn't (find a way to) tell the program what Y and N meant. I tried creating textStrings but I couldn't seem to fit them into my if (statement? thingy, box...) to tell it that Y == this and no that.

I have only learned about booleans and integers so far, so this is a bit out of my league (I'm a musician, not an engineer, damnit!:) )

I've attached my project in which I use a boolean, with the True/false-choice in the end, which I would like to change. As zip, since Alice 3-format isn't supported by the forum.

Anton

Edit: Maybe I should ask a question also... :) Is there a way to get the player to make a Y / N -choice instead of a true/false?


All times are GMT -5. The time now is 05:30 AM.

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