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.