Alice Community  

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

Reply
 
Thread Tools Display Modes
Doesn't work in Jython
Old
Niteshifter
Guest
 
Status:
Posts: n/a
Default Doesn't work in Jython - 02-13-2010, 12:07 AM

Not really sure what the problem is with this (as there's no debugger in Alice), but I've gone over syntax errors and logic errors to find that there's nothing wrong with it, however I still get errors. Here's the code:

Code:
def hx(n):
    a = ['0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F']
    x = n % 16
    y = ''
    if (n-x) == 0:
        y = a[x]
    else:
        y = hx((n-x)/16) + a[x]
    return y

print hx(65565)
Output should be '1001D' however I just get the error screen, so I bet I'm missing something, or Jython isn't able to handle something in this piece.
   
Reply With Quote
Old
zonedabone
Senior Member
 
zonedabone's Avatar
 
Status: Offline
Posts: 577
Join Date: Nov 2008
Location: In the interwebs
Default 02-13-2010, 07:26 AM

Alice's Jython module is incomplete. no advanced functions are majorly supported.


'Apple Macintosh' - An anagram of 'Complaints Heap'

M.A.C.I.N.T.O.S.H. - Machine Always Crashes, If Not, The Operating System Hangs.

You're *such* a mac person.
   
Reply With Quote
Old
zonedabone
Senior Member
 
zonedabone's Avatar
 
Status: Offline
Posts: 577
Join Date: Nov 2008
Location: In the interwebs
Default 02-13-2010, 07:31 AM

Sadly, Alice's Jython module isn't capable of accessing the print buffer. This must be done by the external GUI. Try this program.
Attached Files
File Type: a2w Printscript.a2w (162.0 KB, 6 views)


'Apple Macintosh' - An anagram of 'Complaints Heap'

M.A.C.I.N.T.O.S.H. - Machine Always Crashes, If Not, The Operating System Hangs.

You're *such* a mac person.
   
Reply With Quote
Old
Niteshifter
Guest
 
Status:
Posts: n/a
Default 02-13-2010, 02:46 PM

I see now. Assign variables and call print from the outside.

Thanks.
   
Reply With Quote
Old
zonedabone
Senior Member
 
zonedabone's Avatar
 
Status: Offline
Posts: 577
Join Date: Nov 2008
Location: In the interwebs
Default 02-13-2010, 03:29 PM

Yep. no problem!


'Apple Macintosh' - An anagram of 'Complaints Heap'

M.A.C.I.N.T.O.S.H. - Machine Always Crashes, If Not, The Operating System Hangs.

You're *such* a mac person.
   
Reply With Quote
Reply


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 ©2024, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.