[Community Puzzle] CG Chat Interpreter - Part 1

(I created the topic, because I did not find any for this puzzle.)

I just want to highlight that this puzzle has the best, most helpful set of test cases ever on CG! Without these inline hints, it would have been much less fun…
Congrats and big :+1: , also for the puzzle idea!
I always knew that WebChat HAS TO have some meaning… (at least when I am not trolling there) :slight_smile:

PS: Part 2 of this puzzle seems to take a bit too long in the making, or where is it? :wink:


I wholeheartedly agree! This puzzle was a lot of fun, and I learned a lot, too. As you said the commented test cases were a godsend.

I used Crafting Interpreters as a guide to implement parsing and interpreting the chat log. I probably couldn’t have solved the puzzle without it.

Everywhere i go i see regex now…

This is a great puzzle, and I was able to get it to work from the test cases. However:

  1. Example 5 has incorrect input:

1 0
lines times

The given number of good nouns is 1, but there are actually 2 good nouns. The example will fail unless you ignore the given count of good nouns in favor of the actual number of good nouns given.

  1. The instructions are not exactly clear about how to treat keywords that are found in unexpected places; e.g., should the entire statement be ignored, or should the keyword be treated as a flavor word, etc. E.g., in Example 11, in the statement “I thought you’re a beginner, just like me and FlamingImp_5f5d too?”, the word “a” is a keyword indicating the beginning of a numeric constant; however, because there is no good or bad noun following on the line, it should be treated as a flavor word. This will lead to some weird syntactic ambiguities in compound expressions with multiple constants since there may not be 1:1 matching. It was possible to figure out for the particular example from the inline comments in the example input (great idea, BTW), but the precise rules of the grammar should be spelled out in the instructions, IMO.
1 Like

Re point 1: Good catch! I’ve fixed the incorrect input.