[Community puzzle] Bulk Email Generator

This topic is about the puzzle Bulk Email Generator.

Feel free to send your feedback or ask some help here!

I thought it was a very good challenge. I found (it|the puzzle|:slight_smile:) to be fun to solve, and just the right amount of difficulty. I think I enjoyed it because it at first glanced looked very simple, but then some of the edge cases took a little thought, so just like the real world, lol.

1 Like

Thank you for the kind words. Much appreciated. :blush:

About that, my solution passes all tests but fails the JBM Email validator.
Do you think there’s edge cases that are not covered in test cases? I can’t think of anything else.

I don’t think so, but who knows? If you PM me your code I’ll take a look.

i can’t pass it too, is there something like escaped characters in parenthesis text?

That validator is supposed to be easier than the matching test, really.
You too can DM me your code for cross-verification, and I’ll take a look.

You two are getting me worried. There was a huge transient data-corruption-thingy around at the time I was trying to submit the puzzle, that actually prevented me from getting it out of draft for a long time, but that was supposed to be fixed.

What tripped up djjeck’s code was the fact the “JBM Email” case contained a unicode curly apostrophe, and for some reason simply reading and writing it back messes it up.

Obviously proper UTF-8 management wasn’t supposed to be a part of the problem, so <Change Announcement> I’m editing it out.

Sorry for the unintended hurdle.

PS: for the curious, the string was “won’t”, which I replaced by “won’t”. It was outside of any parenthesized group.

Makes me think that maybe I should start trying to validate all community submissions in C / C++ before approving them. It just slows down even further what is already a slow process for me. :slight_smile:

  • danBhentschel

IMHO the best actual solution would be UI feedback in the problem editing interface that outlines any I/O box that contains non-ASCII Unicode say purple. And adds a warning before any non-draft commit in the lines of “Your I/O contains non-ASCII Unicode. This is known to make the problems much harder to debug in some languages. Are you sure you want to do this?”

1 Like

I’ve mentioned this idea before. Unfortunately, I’m not holding my breath for it. I understand. People are busy. :slight_smile:

  • danBhentschel

just confirming it’s working now, thx :slight_smile:

1 Like

Found: Nothing
Expected: Nothing

… what it writes in test 3


I do not understand this part “Random is defined as using the JBM level-0 twister: “for the ith choice, pick the ith clause (modulo the number of clauses)”.”. When it is the 4th choice and there are only 2 choices what word I have to pick? And for the 3th choice with only 2 choices?

When it’s the 4th choice and there are only 2 clauses, you pick clause index 4 mod 2 = 0 (that’s the 0-indexed first one)
When it’s the 3rd choice and there are only 2 clauses, you pick clause index 3 mod 2 = 1 (that’s the 0-indexed second one)

Gah, shouldn’t answer before coffee, see below for proper answer.

Thanks for your fast reply.

For the 3th test case the 4th line (and 4th choice to make) is “Does it (wrap|unwrap)?” and “wrap” must be used but I get:
Found: Does it wrap?
Expected: Does it unwrap?

That’s because I’m explaining it bad, and stupid human convention to index at 1 for ordinals makes it worse.

The general idea is: you take the choices in order, not skipping any (i.e., starting with the “first”), looping when you move past the end.

Expressed mathematically involves actually using 0-based indices, so:

  • When it’s the [human] 4th choice and there are only 2 clauses, you pick clause [sane] 3 mod 2 = 1. Which translates to “second” in human terms.
  • When it’s the [human] 3rd choice and there are only 2 clauses, you pick clause [sane] 2 mod 2 = 0. Which translates to “first” in human terms.

But I think understanding the general idea is more important than reading the math.

So indeed “Does it (wrap|unwrap)” should unwrap.

Thanks for explaining, I fixed it but I still get some other results… Will skip this puzzle, I get the idea and believe my solution is correct. Thanks for your effort.

Sorry, but personally I found the description of this puzzle completely confusing. First, this thing with “random” choices, but it’s okay, finally I got it without any help. But I don’t understand the main idea of the puzzle - should I print all possible templates (I mean like Cartesian product) or should I print only one template replacing placeholders with one global increasing index for all choices? It’s not clear and it’s not fun

1 Like

Seems puzzling to me you could get it without understanding the main idea.

But if that suited you, great!