Date sent: Thu, 23 Sep 1999 02:39:56 -0700 (PDT) From: Mordred of CyberLiteSubject: Ring verses in C programming language To: naskrent@hoth.amu.edu.pl Hello again! "(...) There are natural languages, Esperanto, and those quite imaginary. (...)" - you say in your page :) So now you may add anoter group, as this is not a human language, nor an imaginary one. The program compiles under any ANSI C compiler (and under any OS), and when run outputs the total number of Great Rings (20, aren't they :)). Here's a short explanation, if you're not into programming. The part that looks like the ring verses (except some additional punctuation) is the actual program. The first part (the #define-s) command an utility called "preprocessor", which simply replaces text. For example "#define One the+=1" means that every occurence of the text One (case sensitive) should be treated as "the+=1". The actual algorythm uses some nasty and dirty tricks, because some of the words (e.g. "for") are reserved words for the compiler, which means that they have special meaning in programming. If you are interested, I may send you a detailed explanation of everything, but I think it just looks nice :) You know, it is some kind of discrimination to put a language bareer between humans and computers :) So now every computer can read the Ring verses too :) :) :) Have a nice day! Mordred ---------- Cut Here ----------- #define Three int #define Rings main() {int the=3; #define Elven 2 #define kings 1 #define under ; #define sky < 24 #define Seven the+=7 #define Dwarf 2 #define lords 1 #define in ; #define their the #define halls < #define of #define stone 17 #define Nine the+=9 #define Mortal 1 #define men ; #define doomed the #define to < #define die 7 #define One the+=1 #define Dark 1 #define Lord ; #define on the #define his != #define dark 7 #define throne ; #define In if #define Land == #define Mordor 24 #define where #define Shadows -=strlen #define Ring ;if (the #define rule 22 #define all 0 #define them ); #define find 23 #define bring 24 #define and ; #define darkness += #define bind 1 #define CopyRight printf #define c "\n%d\n",the #define by ; #define Tolkien } Three Rings for (the += Elven-kings under the sky; Seven) for (the += Dwarf-lords in their halls of stone; Nine) for (the += Mortal men doomed to die; One) for (the += Dark Lord on his dark throne); In (the Land of Mordor) where the Shadows ("lie."); One Ring to rule them all, One Ring to find them One Ring to bring them all and In (the darkness bind them In (the Land of Mordor) where the Shadows ("lie."); CopyRight(c) by Tolkien -------------- Cut Here ------------