I did read the other day an amazing tale from Arthur C.Clarke, 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.
Dmboyd helped me to set this code ahead:
[CODE]var n = 41;
var letra = new Array();
for (var i = 0; i < n; ++i)
letra.push(String.fromCharCode(i + 0x0f40));
for (var p1 = 0; p1 < n; ++p1)
for (var p2 = 0; p2 < n; ++p2)
for (var p3 = 0; p3 < n; ++p3)
for (var p4 = 0; p4 < n; ++p4)
for (var p5 = 0; p5 < n; ++p5)
for (var p6 = 0; p6 < n; ++p6)
for (var p7 = 0; p7 < n; ++p7)
for (var p8 = 0; p8 < n; ++p8)
for (var p9 = 0; p9 < n; ++p9)
document.writeln(letra[p1]
+ letra[p2]
+ letra[p3]
+ letra[p4]
+ letra[p5]
+ letra[p6]
+ letra[p7]
+ letra[p8]
+ letra[p9]
+ “<br>”);
Unfortunately, there still exist two small problems:
MISSING CODE POINT
Tibetan letters start at U+0F40 and end at U+0F6C, but the last 3 don’t show up in Arial, so I limited the alphabet to the first 41 letters. Besides, code point U+0F48 is missing (go figure why) so the alphabet feeding iteration should skip this number.
How could we do that?
MEMORY OVERRUN
The printout ends after 10256 lines due to memory shortage. The current
[CODE]document.writeln(letra[p1]
must be replaced by some in-place or batch printing or cleaning the memory so no limits affect the iterations within the design boundaries.
Do you have any idea how to do that?
Many thanks for any hint!