Alice Community  

Go Back   Alice Community > Alice 2 > How do I...?

Reply
 
Thread Tools Display Modes
Real to integer
Old
Hypotenuse Man
Guest
 
Status:
Posts: n/a
Default Real to integer - 11-06-2006, 10:12 PM

Hey,

I'm working on a 'guess the number' program, and it's going very smoothly except for one thing - where I have Alice output the guess the user inputs, as well as the number of guesses the user has taken, it invariably comes out as a decimal - 50.0, 67.0, 2.0 - but always one ending in '.0'. Is there any way I can force those real numbers into integers?

Thank you in advance.
   
Reply With Quote
Old
thewhiterabbit.
Guest
 
Status:
Posts: n/a
Default 11-07-2006, 07:40 AM

What you are asking is foolish. First off this cant be done with a program such as alice, and plus... 50.0, 67.0, and 2.0 ARE all real numbers. the square root of a neg is an immaginary number. Try using a different program, i dont believe that you can acomplish this with alice.
   
Reply With Quote
Old
Hypotenuse Man
Guest
 
Status:
Posts: n/a
Default 11-07-2006, 07:59 AM

Yeah, I get that they are all reals. The thing is, I would like to display not 50.0, 67.0, and 2.0, but 50, 67, and 2.
   
Reply With Quote
Old
thewhiterabbit.
Guest
 
Status:
Posts: n/a
Default 11-07-2006, 08:06 AM

just

if # then display in a 3d text the number minus the .0
   
Reply With Quote
Old
Hypotenuse Man
Guest
 
Status:
Posts: n/a
Default 11-07-2006, 08:08 AM

The thing is, I don't know what the number will be - I'm trying to output a variable that's got the offending number in it.
   
Reply With Quote
Old
thetrippster
Guest
 
Status:
Posts: n/a
Default 11-07-2006, 08:42 AM

umm there is a function to force it to display real number without decimels let me look it up
1.click more in the random number tile(purple) and select interger only and true in the pull down menu.

that shoudl only give u numbers without decimels. so yes it is possible to do this in alice.
   
Reply With Quote
Old
Hypotenuse Man
Guest
 
Status:
Posts: n/a
Default 11-07-2006, 08:45 AM

Thanks man, I appreciate it, but I had tried that already - that only forces the random number to be an integer. Everything else is still a real number.
   
Reply With Quote
Old
thetrippster
Guest
 
Status:
Posts: n/a
Default 11-07-2006, 08:47 AM

hmm i guess it shall require more research!!! im off to find out again!!!
   
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 ©2019, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.