# [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 )

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

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 !

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).

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?

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 ?