Alice Community

Alice Community (http://www.alice.org/community/index.php)
-   How do I...? (http://www.alice.org/community/forumdisplay.php?f=16)
-   -   Lose the zero? (http://www.alice.org/community/showthread.php?t=4107)

dragnet 03-22-2010 03:10 AM

Lose the zero?
 
Is there anyway to lose the zero at the end of a number when it is being displayed as a string. I assume it is due to the fact that Alice seems to use doubles for everything. I know you can not cast it to an integer, but has anyone figured out how to lose the zero without having to put something in front of it to hide it?

Thanks.

x2495iiii 03-22-2010 05:22 AM

Unfortunately, no.

rankhornjp 03-22-2010 12:32 PM

1 Attachment(s)
[IMG]http://www.alice.org/community/attachment.php?attachmentid=2651&stc=1&d=1268860209[/IMG]

Like this?

x2495iiii 03-22-2010 03:41 PM

I tried that and it didn't work for me. It may work for him, though, I suppose.

Out of curiosity, are you using 2.0, rankhornjp?

dragnet 03-22-2010 04:02 PM

It works with the random function, but not with the round function.

Oh well!

zonedabone 03-22-2010 04:45 PM

THe random function works, or you could define this function in python:
[PHP]def int(num):
world.out = int(num)[/PHP]

dragnet 03-22-2010 04:53 PM

I'm relatively new to Alice, but know Java, PLSQL, PHP, C#, C etc pretty well as well as some Python. How do you define a Python function and call it within Alice?

dragnet 03-22-2010 05:20 PM

Are the built in functions found in the Required/jython-2.1/Lib folder? If so how do I place a function into the /Lib folder and have it included into the Alice world?

rankhornjp 03-22-2010 08:47 PM

[QUOTE=x2495iiii;18867]I tried that and it didn't work for me. It may work for him, though, I suppose.

Out of curiosity, are you using 2.0, rankhornjp?[/QUOTE]


Yea, 2.04

rankhornjp 03-22-2010 09:04 PM

2 Attachment(s)
Is this what you need?


All times are GMT -5. The time now is 03:40 AM.

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