Join us on Discord!
You can help CodeWalrus stay online by donating here.

Code Golf - The Reboot #9

Started by JWinslow23, July 27, 2015, 07:39:29 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

JWinslow23

I can't believe I've gone about a month without posting another challenge. Time to set things right :walrii:

Hello Omnimaga/CodeWalrus/Cemetech/friends/Romans/countrymen/lend/me/your/ears, and welcome to the ninth installment of...
Code Golf: The Reboot

As you can see, I am @JWinslow23 , the guy who started this idea in the first place. You may recall my weird fifth challenge I devised, and if you do, I'm doing something just as sinister.

Don't know what code golf is? Check out this contest thread OR this really old contest thread for an explanation. Don't know what code is? Then you will not understand this website in general :P

Without further ado...

Challenge 8

Problem

Family Feud is a game show where you try to guess the most popular responses to survey questions, such as "Name something people often steal from the office to use at home", "Name something that gets hard when it gets cold", or "Tell me a famous Dennis". This, of course, has been adapted into many video game ports, including one in 1993 on the Super Nintendo Entertainment System (SNES).

Now, the SNES version has one glitch that makes the game that much more funny: as long as there are the right letters in the right order, the game counts it as correct. This can lead to some rather interesting answers being counted, as seen in this video.

Based on this, here is your challenge: Create a program that, given a string containing a typed-in answer, and another string containing all the accepted answers (encoded in a format explained below), tells the user the answer they matched, and if no answer was matched, tells the user they got a strike.

Let me explain:

The string with the possible answers the game will accept will be encoded and interpreted as follows:

       
  • Answers will be written in uppercase letters.
  • Backslashes "\" separate multiple valid answers for a given entry.
  • Optional parts of answers are enclosed by a pair of underscores "_", i.e. "_RED_ MEAT" means that "RED MEAT" and "MEAT" are both valid.
  • A caret "^" indicates that the following character is optional, i.e. "PICKLE^S" means that "PICKLES" and "PICKLE" are both valid.
  • Spaces are usually optional (except in special cases). For the purposes of the contest, they are always optional.
  • Any double letters are always optional, e.g. "RACCOON" means that "RACCOON" and "RACON" are both valid.
Input for your program will be in the form of "ANSWER YOU TYPED IN:POSSIBLE ANSWER 1:POSSIBLE ANSWER 2:ETC". Output for your program will be in the form of either the lowest answer on the board that it matches, or "STRIKE!" if it matches no answers. To clarify, here are examples:

Input: "CLEANER FLUID:CAR\AUTO:CLOTH_ES_:_KITCHEN_ FLOOR:BODY:TOWEL^S:BATHROOM:DISH_ES_"
Output: "CAR\AUTO"

Input: "FABULOUS DIET WATER:CLOTH_ES_\SHOES:FAT\WEIGHT:BILLS:FOOD:TIME"
Output: "FOOD"

Input: "CODE GOLF CONTEST EIGHT:SOCK^S\HOSE\STOCKINGS\NYLONS:PURSE^S\POCKETBOOK\BAG:POLISH:LACES"
Output: "STRIKE!"


If any more clarification is needed, contact me. I'll try not to give you COMMANDS FOR US INVASION... (whoops, I mean CONFUSION :P )

Scoring

All non-calc languages will be scored with this counter.
Assembly programs will be scored on binary size (minus the header), and TI-BASIC and Axe will be scored on on-calc source size (again, minus the header). For Axe, the entire first line (for example, ".PROGNAME") does not count.

Submission

PM me over on Omnimaga, Cemetech, or CodeWalrus with the code, or make an unlisted YouTube video and PM me the link. (If you take the latter option, then congrats for you :P )

Good luck! I wanna see if Feud come up with clever answers!

SysRPL



RankUserSizeDate
13298220.5 (I swear)Jul 29 2015 05:44:37 pm

Java



RankUserSizeDate
13298371Jul 30 2015 04:47:10 pm

C



RankUserSizeDate
13298334Jul 30 2015 04:47:10 pm

Language Ranking





RankLangUserSizeDate
1SysRPL3298220.5 (I swear)Jul 29 2015 05:44:37 pm
2C3298334Jul 30 2015 04:47:10 pm
3Java3298371Jul 30 2015 04:47:10 pm

Powered by EzPortal