https://www.codingame.com/training/easy/decode-the-message
Send your feedback or ask for help here!
Created by @BiMathAx,validated by @anon91538998,@Nazdhun and @NitMpez.
If you have any issues, feel free to ping them.
https://www.codingame.com/training/easy/decode-the-message
Send your feedback or ask for help here!
Created by @BiMathAx,validated by @anon91538998,@Nazdhun and @NitMpez.
If you have any issues, feel free to ping them.
My two cents: Thatās a pretty big leap between Tests 4 and 5 with not a lot of description to help the solver.
Iām stuck too at the test 5 and 6 but I pass test 7ā¦ Any idea why?
I found the problem in my 2-loop, I must work just on words of the last length i.e the set of 1char or 2 chars or 3 chars, etcā¦
A fun little puzzle.
I found the English instructions a bit difficult to understand; particularly the description of the encoding scheme. Maybe the French ones are clearer?
I would have enjoyed some longer messages in the test cases.
While the types of the problem inputs are present in the auto-generated code, it would be nice to have them explicitly stated in the instructions as well.
Do āhelloā and Ā«bonjourĀ» really encode exactly to the same value ā7073801ā with the 26-letter alphabet, just as the bilingual statement suggests? Seems an unlikely coincidence to me, especially as encoding is supposed to be uniqueā¦
No it doesnāt Iāve modified the value in the description.
Iāve also modified all the tests for consistency, all characters are now unique in their alphabets, and the last ones are less forgiving.
@MACKEYTH I agree it could be clearer, but figuring out how the value is computed is also part of the puzzle. If you have a better description in mind feel free sharing it.
FYI the English instructions appear to be a Google Translate of the French:
You are an FBI agent and you intercepted a message from terrorists.
This message must be decrypted, and for this you have access to 2 pieces of information: P and C.āCā is the alphabet used to write the message and contains all the letters / characters needed to decode it.
P corresponds to the coded value of the message.
Fortunately, you know how this value is calculated, and now you need to reverse the following process:
- Assuming that the alphabet is āabcdā, each letter is associated with its index: a = 0, b = 1, c = 2, d = 3.
- Then a new letter is added for the following values: aa = 4, ba = 5, ca = 6, da = 7, ab = 8, bb = 9, cb = 10, etc.
- The whole message thus obtains a unique value. For example, with a full alphabet (26 letters), āhelloā would be 7073801.
Make it agent!
Actually itās the opposite, the french text was made from the english one.
But Iām wondering if the french part should not be removed. Itās not my puzzle so Iād feel bad reworking everything
Unless Iām wrong, the general idea is everything in English, thus it should have been removed before approval (doubly so if one is just a straight translation of the other). Thatās my vote.
How about something like:
[spoil]āP is a summation of n terms (with n being the length of the message and the alphabet index starting at 0) as follows:
(alphabet index of letter 1) + ( ( (letter 2 index) + 1 ) * alphabet size^1 + ā¦ + ( ( (letter n index) + 1 ) * alphabet size^(n - 1) )ā[/spoil]
Heh, that may be a bit TOO descriptive.
The description should not give a general formula, otherwise thereās no puzzle left
Iāve updated the description, can you tell me if itās clearer now ?
Itās nearly the same puzzle:
Is the only difference that the String would be in reverse order?
Then the argument is (and I know Iāve beat this horse dead), why is one of these hard and the other easy?
Because itās an old puzzle from 4 years ago, difficulty was kind of a mess back then. And it cannot be edited anymore (unless you ask a CG member I guess).
Was it really a mess back then? Or is it more so now? I know this is slightly off topic here and I bring this up a lot but what is an āeasyā puzzle? What is a āhardā one? If there are no rules codifying how that is decided, then we keep ending up back here to the same spot.
Typically many hard/very hard puzzles from back then would be downgraded in difficulty now, sometimes by a lot like in this case. Since the difficulty ranking has never been formalized itās still a bit messy, but imo itās in a better place currently.
All test cases are passing my JS code, however validator 6 isnāt.
Can we get a bit more description about validator 6?
I canāt get my head around it.
Thanks
For anyone trying to do this problem, I suggest first write an encode function to encode a string into a number. Then you write your decode function to reverse the number back into the string.
Doing this way is like having a unit test that you can try plenty of self-made test cases, encode and then decode and then match the result with your own original string. Very soon you will discover where the bug is.