15
\$\begingroup\$

FizzBuzz was fun, and I got great feedback and learned a few things (which I hope I put in practice here), but only scratched the surface. I wanted to explore the LOLCODE language a bit more, so I implemented a little rock-paper-scissors, to play with functions, parameters, return values.. and user input.

Unfortunately I haven't figured out how to get compileonline to take more than a single value through STDIN, so I dropped the idea of making a GAEMLOOPZ and only made it a single round.

Also AFAICT there's no way of generating random numbers in LOLCODE (specs), so the LOLCAT always wins - it even has a seekrit move for invalid inputs!

HAI 1.2

  I HAS A CHEEZ ITZ "CHEEZ"       BTW "ROCK"
  I HAS A BURGR ITZ "BURGR"       BTW "PAPER"
  I HAS A WAFLZ ITZ "WAFLZ"       BTW "SCISSORS"
  I HAS A SEEKRITMOOV ITZ "ZPOCK" BTW SHH, SEEKRIT


  HOW IZ I GETAMOOV

    VISIBLE "WHAT U PLAY?"
    VISIBLE "[C]HEEZ [B]URGR [W]AFLZ"

    I HAS A MOOV
    GIMMEH MOOV

    MOOV R I IZ VALID8MOOV YR MOOV MKAY
    FOUND YR MOOV

  IF U SAY SO

  HOW IZ I VALID8MOOV YR MOOV

    MOOV, WTF?
      OMG "C", OMG "c"
        MOOV R CHEEZ
        GTFO

      OMG "B", OMG "b"
        MOOV R BURGR
        GTFO

      OMG "W", OMG "w"
        MOOV R WAFLZ
        GTFO

      OMGWTF
        ANY OF BOTH SAEM MOOV AN "ZPOCK" AN BOTH SAEM MOOV AN "zpock" MKAY
        O RLY?
          YA RLY, MOOV R SEEKRITMOOV
          NO WAI
            MOOV R SMOOSH "... WUTS " AN MOOV AN " ANYWAI" MKAY
        OIC

    OIC

    FOUND YR MOOV

  IF U SAY SO

  HOW IZ I PIKAMOOV YR MOOV

    I HAS A ULTIMAETMOOV

    MOOV, WTF?
      OMG "CHEEZ" BTW must be a constant value :(
        ULTIMAETMOOV R BURGR
        GTFO

      OMG "BURGR" BTW must be a constant value :(
        ULTIMAETMOOV R WAFLZ
        GTFO

      OMG "WAFLZ" BTW must be a constant value :(
        ULTIMAETMOOV R CHEEZ
        GTFO

      OMG "ZPOCK" BTW must be a constant value :(
        ULTIMAETMOOV R "Y U CHEAT? I"
        GTFO

      OMGWTF
        ULTIMAETMOOV R SEEKRITMOOV

    OIC

    FOUND YR ULTIMAETMOOV

  IF U SAY SO

  HOW IZ I WINTEHGAEM YR MOOV AN YR ULTIMAETMOOV

    VISIBLE SMOOSH "Y U PLAY " AN MOOV MKAY
    VISIBLE SMOOSH "MAH " AN ULTIMAETMOOV AN " WINZ LOL" MKAY

  IF U SAY SO

  OBTW      
    was going to make a GAEMLOOP,
    but stupidly I can't seem to figure out
    how to pass multiple values to STDIN with this "IDE"...
    so this program will only run a single round.
  TLDR

  HOW IZ I PLAYAMOOV

    I HAS A MOOV
    MOOV R I IZ GETAMOOV MKAY

    I HAS A ULTIMAETMOOV
    ULTIMAETMOOV R I IZ PIKAMOOV YR MOOV MKAY

    I IZ WINTEHGAEM YR MOOV AN YR ULTIMAETMOOV MKAY

  IF U SAY SO

  VISIBLE "CHEEZ-BURGR-WAFLZ:)"
  I IZ PLAYAMOOV MKAY

KTHXBYE

Outputs

Input: c or C

CHEEZ-BURGR-WAFLZ

WHAT U PLAY?
[C]HEEZ [B]URGR [W]AFLZ
Y U PLAY CHEEZ
MAH BURGR WINZ LOL

Input: b or B

CHEEZ-BURGR-WAFLZ

WHAT U PLAY?
[C]HEEZ [B]URGR [W]AFLZ
Y U PLAY BURGR
MAH WAFLZ WINZ LOL

Input: w or W

CHEEZ-BURGR-WAFLZ

WHAT U PLAY?
[C]HEEZ [B]URGR [W]AFLZ
Y U PLAY WAFLZ
MAH CHEEZ WINZ LOL

Input: zzz ..or pretty much anything else:

CHEEZ-BURGR-WAFLZ

WHAT U PLAY?
[C]HEEZ [B]URGR [W]AFLZ
Y U PLAY ... WUTS zzz ANYWAI
MAH ZPOCK WINZ LOL

Input: zpock or ZPOCK

CHEEZ-BURGR-WAFLZ

WHAT U PLAY?
[C]HEEZ [B]URGR [W]AFLZ
Y U PLAY ZPOCK
MAH Y U CHEAT? I WINZ LOL

I don't like that I'm hard-coding the strings in the WTF (switch) block in VALID8MOOV, but I don't think it's possible to extract just the first letter of a YARN (string)... or is it? Also there doesn't seem to be a way of defining compile-time constants, so I had to put literal strings in PIKAMOOV as well.

\$\endgroup\$
  • 1
    \$\begingroup\$ specs link is broken btw \$\endgroup\$ – Vogel612 Feb 2 '15 at 13:35
16
+50
\$\begingroup\$
HAI 1.2

    I HAZ A REVIEW ITZ "Following" BTW Let's roll ;)

I got a few points I want to make here and the first is actually quite simple. Don't name your names in INTORN3TZP34KZ...

Yes I know it's an esoteric language, and I know that all the instructions are defined to be "Internet-Speaks". But that doesn't mean you absolutely have to make your code follow the spec definitions.
(Who makes their Stack a class anyway..)

CHEEZ, BURGR, WAFLZ, SEEKRITMOOV, ... these names are suboptimal. (Pardon my non-french).

You had it pointed out to you in your previous question, that the documentation uses lowercase for variables. (Seems the specs changed that...)
I think you should adopt either that or at least anything but SHOUTCASE! There is no need to give a darn about convention when convention is dumb ;)

Especially with the missing syntax highlighting it is hard to read your code and differentiate between instructions and identifiers.

Additionally to that I want to suggest using non-speakzified variable names. Simply because it's easier on the brain to not have to unwrap the variable name before being allowed to think about what the variable name means in the first place.

Moving swiftly on from names to... names..

PIKAMOVE - Is it just me or does that call associations with Pokémon to your head??
VALID8MOOV - What's the 8 anyways???

The names you chose are confusing. Might (wink wink) be because you actually made them Internetspeakz again :(

Next!

Whitespace / Newlines

    OIC

    FOUND YR ULTIMAETMOOV

  IF U SAY SO

  HOW IZ I WINTEHGAEM YR MOOV AN YR ULTIMAETMOOV

let's see how you'd put braces in Java (or C# for that matter) for this code:

    }
    return ultimateMoov;
}

void winthegaem (Object moov, Object ultimatemoov) {

You might want to additionally differentiate the "difference" between IF YOU SAY SO and HOW IZ I. I'd either add an additional newline between these or remove them on "closing the braces".

Comments

  OBTW      
    was going to make a GAEMLOOP,
    but stupidly I can't seem to figure out
    how to pass multiple values to STDIN with this "IDE"...
    so this program will only run a single round.
  TLDR

Hmm.. Interesting. But completely irrelevant for the code This comment is not helping. You did mention it in your explanation, so in the code it's meaningless.

Reading the code does not become easier with reading this comment. Remove it.

OMGWTF

Y U NO?

    OMG "ZPOCK", OMG "zpock"
        MOOV R SEEKRITMOOV
        GTFO

    OMGWTF
        MOOV R SMOOSH "... WUTS " AN MOOV AN " ANYWAI" MKAY
  OIC

KTHXBYE

BTW End of review ;)

\$\endgroup\$
  • 7
    \$\begingroup\$ TLDR Just Voted, JK LOL. \$\endgroup\$ – Malachi Sep 18 '14 at 14:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.