Programming nìNa'vi ni'aw!

Started by Irtaviš Ačankif, July 22, 2011, 07:27:31 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Irtaviš Ačankif

The C++ preprocessor can do wonders. Such like allowing you to program in Na'vi:

(this program capitalizes every word of the input)
Quote#define txo if
#define txokefyao else
#define kHol double
#define sHol int
#define plltxe printf
#define tengkrr while
#define tatxaew return
#define plltxeie cout
#define tin void
#define liu string
#define liuu char
#define pate gets
#define srane true
#define kehe false
#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;

tin putst(liu st)
{
   plltxeie << st;
   plltxeie << "\r\n";
}

liu wordArr[2048];

liu capitalize(liu word)
{
   word[0] = toupper(word[0]);
   tatxaew word;
}

bool populate(liuu arr[])
{
   sHol counter = 0;
   sHol wcounter = 0;
   sHol arrlen = strlen(arr);
   liu tempWord = "";
   tengkrr (counter < arrlen)
   {
      tengkrr (arr[counter] != ' ' && arr[counter] != '\0')
      {
         tempWord += arr[counter];
         counter++;
      }
      wordArr[wcounter] = tempWord;
      wcounter++;
      tempWord = "";
      counter++;
   }
   wordArr[wcounter]="EOL";
   tatxaew srane;
}


sHol main()
{
   liuu tempArr[65536];
   pate(tempArr);
   populate(tempArr);

   sHol counter = 0;
   tengkrr (wordArr[counter] != "EOL")
   {
      plltxeie << capitalize(wordArr[counter]); plltxeie << " ";
      counter++;
   }
   tatxaew 0;
}

;D ;D
Previously Ithisa Kīranem, Uniltìrantokx te Skxawng.

Name from my Sakaš conlang, from Sakasul Ältäbisäl Acarankïp

"First name" is Ačankif, not Eltabiš! In Na'vi, Atsankip.

bommel


Clarke

One problem: How do you deal with '?  :P

And shouldn't the last statement be tatxaew HUM_ANSYEM;)

Irtaviš Ačankif

No. I think in C++ return 0 means success. You have to return an integer.

The glottal stop? I'd just drop it.

plltxe("Kaltxì 'Rrta!");
Previously Ithisa Kīranem, Uniltìrantokx te Skxawng.

Name from my Sakaš conlang, from Sakasul Ältäbisäl Acarankïp

"First name" is Ačankif, not Eltabiš! In Na'vi, Atsankip.

Clarke

#4
I meant this, but you didn't import cstdlib anyway.

EDIT:
#define txo if
#define txokefyao else
#define kHol double
#define sHol int
#define plltxe printf
#define tengkrr while
#define tatxaew return
#define plltxeie cout
#define tin void
#define liu string
#define liuu char
#define pate gets
#define srane true
#define kehe false
#include <cstdlib>
#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
sHol main()
{
plltxe("Kaltxì 'Rrta!");
  tatxaew EXIT_SUCCESS;
}

produces:
Kaltx∞ 'Rrta!
:( Windows doesn't seem to like Unicode.

Irtaviš Ačankif

I am using Eclipse with MinGW C++, which is basically a framework that guarantees that your program will compile and run the same way on any platform you like. Your code doesn't work in MinGW (error on the EXIT_SUCCESS part). What compiler are you using? Maybe it automatically adds #define EXIT_SUCCESS 0 on the top. Yup, no luck with Unicode.
Previously Ithisa Kīranem, Uniltìrantokx te Skxawng.

Name from my Sakaš conlang, from Sakasul Ältäbisäl Acarankïp

"First name" is Ačankif, not Eltabiš! In Na'vi, Atsankip.

Clarke


Tsamsiyu92


Kamean

Tse'a ngal ke'ut a krr fra'uti kame.


hemmond

Awesome. :D Maybe I'll move drom PHP to C++ :D
old gallery link?id=1849[/img]
old gallery link?id=1890[/img]

http://twitter.com/hemmondssandbox

If it's change in you, then the world is changing too.
--22nd World Scout Jamboree anthem.

Clarke

Manual memory management is not your friend. :(

Blue Elf

Loving this! Does anyone know how to redefine keywords in c#?
I once written a few comment in my prog nìNa'vi. When my boss saw that, he was a little angry.  If I'd write code completely in Na'vi, I'll probably get fired immediately ;D
Oe lu skxawng skxakep. Slä oe nerume mi.
"Oe tasyätxaw ulte koren za'u oehu" (Limonádový Joe)


Clarke

Can't do it in C#, sorry.  :( At least, not without rolling your own preprocessor.

Human No More

Txantsan :P

...if only I was better at C... and at Na'vi :(
"I can barely remember my old life. I don't know who I am any more."

HNM, not 'Human' :)

Na'vi tattoo:
1 | 2 (finished) | 3
ToS: Human No More
dA
Personal site coming soon(ish

"God was invented to explain mystery. God is always invented to explain those things that you do not understand."
- Richard P. Feynman

'Oma Tirea

Quote from: Uniltìrantokx te Skxawng on July 22, 2011, 07:27:31 PM
#define txo if
#define txokefyao else
#define kHol double
#define sHol int
#define plltxe printf
#define tengkrr while
#define tatxaew return
#define plltxeie cout
#define tin void
#define liu string
#define liuu char
#define pate gets
#define srane true
#define kehe false

It should probably be liuvi for char, and there doesn't need to be an e in tatxaew.  Also txokefyao is spelled txokefyaw.

I thought coming up with programming nìNa'vi would happen sooner or later ;D

[img]http://swokaikran.skxawng.lu/sigbar/nwotd.php?p=2b[/img]

ÌTXTSTXRR!!

Srake serar le'Ìnglìsìa lì'fyayä aylì'ut?  Nari si älofoniru rutxe!!

Irtaviš Ačankif

Quote from: Thomas R on July 24, 2011, 03:31:22 PM
Can't do it in C#, sorry.  :( At least, not without rolling your own preprocessor.

Indeed. I program GUI stuff in C# and Windows Forms or GTK# because GUI with C++ is a nightmare and impossible to learn for me. C# is like my RAD language to fall back to when I need to hack up something for myself in 10 minutes.
Previously Ithisa Kīranem, Uniltìrantokx te Skxawng.

Name from my Sakaš conlang, from Sakasul Ältäbisäl Acarankïp

"First name" is Ačankif, not Eltabiš! In Na'vi, Atsankip.

bommel

Yes, C# is a lot easier when it comes to GUI (actually I think it's a lot easier than C in all aspects ^^)

Irtaviš Ačankif

For simple programs like the one I posted C# is more complicated. Additionally C# is very funny when it comes to writing algorithms, they just run slowly...

C# is also bad at number crunching like calculating pi and low level operations, which require convoluted calls to the Win32 API or an object reference to an obscure class hidden within the enormous .NET Framework.

The worst thing about C# is that it is not compiled to machine code and requires the full framework to run. How I wish that somebody makes a C# compiler to machine code...even if it only supports the basic standardized classes I would be saying irayo till his memikyun fall off.
Previously Ithisa Kīranem, Uniltìrantokx te Skxawng.

Name from my Sakaš conlang, from Sakasul Ältäbisäl Acarankïp

"First name" is Ačankif, not Eltabiš! In Na'vi, Atsankip.

bommel

Though I work a lot with C# I can't tell you much about its internal optimization. Recently I had a discussion with some C++ guy about Java's performance (which is in terms of architecture quite similar to C#). And Java has some neat features to optimize runtime performance even if it is byte code, too. For example, the JVM has automatic hot spot detection and supports just in time compilation (i. e. it will create machine code on the fly for certain functions if necessary). And according to some benchmarks I've found on the net Java isn't as slow as some people may argue. In general it is slower than native C code but for a lot of applications the difference is rather low and you shouldn't forget about what you gain when using Java or C# (integrated garbage collection, no need to use pointers, etc.). And IMHO, most of an application's performance depends on the programmer, not the compiler. I've seen enough bad and slow code written by programmers who claim they use C because it's faster.

Human No More

A lot of people just say "it uses a VM therefore it's slow' without any evidence or justification.
"I can barely remember my old life. I don't know who I am any more."

HNM, not 'Human' :)

Na'vi tattoo:
1 | 2 (finished) | 3
ToS: Human No More
dA
Personal site coming soon(ish

"God was invented to explain mystery. God is always invented to explain those things that you do not understand."
- Richard P. Feynman