Writing Lolcode

August 17, 2017

Ever heard of the term esoteric programming language? Although those languages are often not really designed to be simple (like Brainfuck), readable (like Whitespace) or even linear (like Befunge or Piet), most of them are turing complete, meaning they're as powerful as "normal" languages.

Last week I had a closer look at LOLCODE!

Code in LOLCODE looks like this:

HAI
I HAS A CATNIP ITZ 3
IM IN YR LOOP UPPIN YR CATNIP
   VISIBLE SMOOSH "I LUVZ CATNIP ITZ " AN CATNIP MKAY
IM OUTTA YR LOOP
KTHXBYE

Lolcode is fun to write and although inefficient, you can indeed do pretty much everything. There's even a formal Lolcode 1.2 specification and a course on codeschool to learn the basics :-)

I decided to write a program that actually has some use, so I wrote a Pokemon Go IV rater in lolcode, check it out on Github.

A solid Arkani with 91%!

It calculates the special IV values (individual values) for a given pokemon (which are unique to each pokemon), you'll just have to enter what kind of pokemon it is and some stats for it:

You can try it here: repl.it

Just hit Run and enter your stats at the right. You can also use lol-coffee if you want to run it locally.

Unfortunately, it misses arrays and lists (as for now, there's a reserved keyword BUKKIT for future versions), so I rewrote those as simple function calls, which is why the program ended up to be ~700 LOC. Other actions like input is really simple, here's the beginning where the user gets asked all of the input values:

HAI
VISIBLE "O HAI!"

BTW GIMMEH GIMMEH GIMMEH!
I HAS A POKEMON_NR, VISIBLE "GIMMEH POEKMON NR", GIMMEH POKEMON_NR
I HAS A MY_CP, VISIBLE "GIMMEH CP", GIMMEH MY_CP
I HAS A MY_HP, VISIBLE "GIMMEH HP", GIMMEH MY_HP
I HAS A MY_DUSTPRICE, VISIBLE "GIMMEH DUSTPRICE", GIMMEH MY_DUSTPRICE

BTW SOEM MAGICAL MAHT FUNTCION HOW TO CALCULAET CP W00T HOW IS THS EVN WURKIN
HOW DUZ I CP_MULTIPLIER YR LVL
  BOTH SAEM LVL AN 1, O RLY?, YA RLY, FOUND YR 0.094, OIC
...