Alice Community

Alice Community (http://www.alice.org/community/index.php)
-   How do I...? (http://www.alice.org/community/forumdisplay.php?f=16)
-   -   rounding to whole numbers (http://www.alice.org/community/showthread.php?t=2599)

blaklite 04-30-2009 01:40 PM

rounding to whole numbers
 
in my world i have a skateboard that is both rolling and spinning variable amounts depending on where you set the feet on them. I'm looking for a way to make it so that when the board lands (finishes its spin) it will know whether or not the trick was landed.
also, since alice is working with long decimal numbers here, it will need to approximate within a certain range whether the board has spun enough or not.

in pseudo:

if (board's amount rolled) == (something close to whole number):
run trick landed, evaluate trick, etc
else:
run trick failed


is it possible to manipulate numbers like that in alice?

elementface 05-02-2009 10:16 AM

Heres what you could do


roll=randomNumber(minimum=roll)(maximum=roll)(integerOnly=true)

that should turn any floating decimal into an integer. as to rounding, im not sure how it will work, all i know is that it will be an integer


All times are GMT -5. The time now is 08:55 PM.

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