Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Converting a simple QBASIC program into Javascript

843789Apr 1 2009 — edited Apr 3 2009
Call me mad, but I did read the other day an amazing tale from Arthur C.Clarke, [The Nine Billion Names of God|http://en.wikipedia.org/wiki/The_Nine_Billion_Names_of_God] about Tibetan monks looking to write down all the possible 9 letters combination of the Tibetan alphabet, so the real name of God is finally spelled, and the whole purpose of the human race is fulfilled.

For that purpose, and after centuries doing it manually, they finally rent a computer.

I liked the tale and wanted to mimic it using my own laptop. I already wrote a Basic program to swap nine ASCII characters. But my ultimate goal is to post a javascript in my blog so readers can see it working while they read along.

The code I wrote is very simple.

{color:#0000ff}
CLS
N = 26 
DIM LETRA$(1 TO 26)
FOR I = 1 TO 26 'FEEDS 26 ASCII CHARACTERS INTO THE NINE CHARACTERS SWAPPING ROUTINE
READ LETRA$(I)
NEXT I
FOR P1 = 1 TO N 'NINE CHARACTERS SWAPPING ROUTINE
FOR P2 = 1 TO N
FOR P3 = 1 TO N
FOR P4 = 1 TO N
FOR P5 = 1 TO N
FOR P6 = 1 TO N
FOR P7 = 1 TO N
FOR P8 = 1 TO N
FOR P9 = 1 TO N
PRINT LETRA$(P1); LETRA$(P2); LETRA$(P3); LETRA$(P4); LETRA$(P5); LETRA$(P6); LETRA$(P7); LETRA$(P8); LETRA$(P9)
NEXT P9
NEXT P8
NEXT P7
NEXT P6
NEXT P5
NEXT P4
NEXT P3
NEXT P2
NEXT P1
END
DATA "A","B","C","D","E","F","G","H","I","J"
DATA "K","L","M","N","O","P","Q","R","S","T"
DATA "U","V","W","X","Y","Z"
{color}
So, this is my question: How could I convert that into Javascript? And, taking advantage of Javascript supporting UTF-8, how could I swap Tibetan characters instead?

There's about 30 of them, not bit deal.

I hope you like my project and want to give it some friendly hand.

Thanks!

Diego
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 1 2009
Added on Apr 1 2009
14 comments
895 views