[Community Puzzle] Agent X, Mission 1 β€” The Caesar Cipher - Puzzle discussion

Coding Games and Programming Challenges to Code Better

Send your feedback or ask for help here!

Created by @Jnath,validated by @flopy78,@LoicGestin and @AlexMtz.
If you have any issues, feel free to ping them.

Hello fellow agents, every time I test my solution, I get following console output:

Oops … a system error has occured!

Maybe some sabotage from the enemy?
Proceed with caution.

1 Like

Yes, the bug has been reported here and in the Discord forum.

3 Likes

So it is really a sabotage? Wow, we must be in something big…
(Sorry, I got carried away :grinning:)

The puzzle states that the key is always positive and the solution to the first test case is 3. But I’m pretty sure it is -3 because you have to subtract 3 from every character to get the right result

The original shift for encryption (i.e. the key) is positive. Now you are doing the reverse process (i.e. decryption) to determine the original shift.

Oh okay. You have to output the key used for encryption, not decryption. Thanks

126βˆ’32(+1)=95
Thus βˆ’3 is +92.

In test9, I find that the key is 94, not 93.
Why?

Too bad for this error, I achieved to do the puzzle with a lot of patience. Every time I got a system error, I was replaying the test case. But the validators seem to be impacted too and the reproduce rate is around 75% (empiric data from my own personal experience). So it’s impossible to submit and get at least one validator green. I think we should get an update when the bug is fixed :smiley:

93 is the correct answer!
When you do
Chr (((Ord (Enter) - 32 - Key) mod 95) + 32) to decode
you are going to have a negative value, you must do
Chr (((Ord (Enter) - 32 - Key + 950) mod 95) + 32)

Sorry for the Pascal Language

((InputChar - 32 - Key + 950) % 95) + 32

Same Error in tests but the submit works fine.

If you take the first character for example : A here.

A is 65 in ASCII If we add the key to encode we got 158. With the warping around we know that β€œ127 is 32” 158-127=31. And 31+32=63. And the 63 char is ?. (Same as the input)

In the hope that this will lead to a better understanding.

There is no negative number in modular integers.
Test 8 is OK, not test 9.
Moreover, 950=0 mod 95.

Got it: you have to find the full word.

Hi,
What’s the difference between test 3 and validator 3 ?
Everything is ok except this validator!
Thx !

1 Like

Same word, different ciphertext.

Are you applying the rules for separating words as described in the text? I was failing validator 3 because I’d not read that properly and included some other characters (brackets).

1 Like

If you think about β€œWords are always separated by SP, , ., ?, ;, : and !”, it’s ok.

the word separation rules are respected in the range of ascii codes from 32 to 126, I failed validator 3 what is the exception for this validation scenario?

1 Like

Tokenization of a line can be tricky. Some hints:

  1. Given hint word must be strictly matched.
    If the hint is β€œtest” and you find β€œtests” in a result, this is not a match.

  2. Apple != apple
    Given hint word must be strictly followed in upper/lower cases.

  3. Token chars ( ,.?;:!) will never be included in a word.
    Examples:
    β€œhi, bye!” makes two words, β€œhi” and β€œbye”. β€œbye!” is not a word.
    β€œ#include <stdio.h>” makes 3 words β€œ#include”, β€œ<stdio” and β€œh>”.

  4. If you find two ways of decryption produce results both including the hint word, you are bad luck because this is an undefined situation in the puzzle. You can complain to the author.

  5. If you find a decryption produce multiple matches to the given hint word, it is allowed.
    Example: hint word is β€œthe” and there are several β€œthe” in the tokenized decrypted line. It is valid.

Should I swap test 3 and validator 3 ?

1 Like