patternModerate
Cheese-Burger-Waffles (aka Rock-Paper-Scissors)
Viewed 0 times
paperscissorscheeseburgerwafflesakarock
Problem
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
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
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
Solution
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 ULTIMAETMOOVlet'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.
TLDRHmm.. 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
OICKTHXBYE
BTW End of review ;)
Code Snippets
OIC
FOUND YR ULTIMAETMOOV
IF U SAY SO
HOW IZ I WINTEHGAEM YR MOOV AN YR ULTIMAETMOOV}
return ultimateMoov;
}
void winthegaem (Object moov, Object ultimatemoov) {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.
TLDROMG "ZPOCK", OMG "zpock"
MOOV R SEEKRITMOOV
GTFO
OMGWTF
MOOV R SMOOSH "... WUTS " AN MOOV AN " ANYWAI" MKAY
OICContext
StackExchange Code Review Q#61561, answer score: 16
Revisions (0)
No revisions yet.