# [Community Puzzle] A story to go in circles

#22

Hi,

I don’t get why my code is working on the 3/4 cases either on tests or on validator.
Here’s what I undesrtood for “Test 4” :
There are 98765432123 steps like this (counting clockwise rotations)

``````a @ c d e f g h i
k l m n # p q r s
u v w x y z a b @
e f g h i j k # m
@ p q r s t u v w
y z a # c d e f g
i j k l m n @ p q
s t u v w x y z a
c d @ f g h i j k
step 0 / position 0 / letter a (1) / 0 rotations
step 1 / position 1 / letter @ / rotating counter-clockwise
step 1 / position 1 / letter s (19) / 3 rotations
step 2 / position 20 / letter a (1) / 3 rotations
step 3 / position 21 / letter k (11) / 3 rotations
step 4 / position 32 / letter d (4) / 3 rotations
step 5 / position 36 / letter e (5) / 3 rotations
step 6 / position 41 / letter c (3) / 3 rotations
step 7 / position 44 / letter g (7) / 3 rotations
step 8 / position 51 / letter l (12) / 3 rotations
step 9 / position 63 / letter @ / rotating counter-clockwise
step 9 / position 63 / letter s (19) / 2 rotations
step 10 / position 1 / letter j (10) / 2 rotations
! step 11 / position 11 / letter y (25) / 2 rotations
step 12 / position 36 / letter w (23) / 2 rotations
step 13 / position 59 / letter x (24) / 2 rotations
step 14 / position 2 / letter i (9) / 2 rotations
! step 15 / position 11 / letter y (25) / 2 rotations
step 16 / position 36 / letter w (23) / 2 rotations
step 17 / position 59 / letter x (24) / 2 rotations
step 18 / position 2 / letter i (9) / 2 rotations
! step 19 / position 11 / letter y (25) / 2 rotations
...
``````

We can see that we don’t need to go every steps as there is a loop between step 11 and 15 which means that step 11, 15, 19, etc. are the same every 4th step.
At step 11, there are 98765432112 steps remaining.
98765432112 is divisible by 4 meaning the 98765432123th step (11 + 24691358028 * 4) is the same as 11.

However, the answer is “i” (the 14th step).

You can argue that depending on how you count steps the answer can vary, but this method worked on “Test 2” (123458 steps looping from 1 to 4) and “Test 3” (975312 steps looping from 8 to 15)

Can someone show me my mistake ?

#23

At step 11, there are 98765432112 steps remaining.

98765432111 because you start at step 0 (step 11 is the 12th).

#24

Thanks, I don’t understand why changing this operation didn’t break the other 2 but it worked.

#25

Hi,

Firstly, thank you @Magicien-d-oz for the puzzle.

I can’t say that was fun because I finally spent too much time to resolve it , but it’s Ok, I have the satisfaction of a job well done.

My main critic is about the level of the puzzle. In absolute, I agree, it’s easy BUT, you have to understand the trick to achieve all tests.
On this point in particular, I think you should at least write a clue in the subject, even something vague like “it’s not so obvious !” or any other warning like that.
Indeed, in comparison with other “easy” puzzles, there is generally an obvious way to resolve it.
Here, I spent a lot of time to optimize the structures, the computations and all little steps of my algorithm with always the same result at the end – Test4 failure.

So I suggest to change the level from easy to medium, or to add a clue or a comment to suggest that the straight way is not the good way.

Thank you very much.
Bye

#26

Hello,
I am delighted that you have succeeded in making this puzzle work That said, this is not the first time I have met someone who has had difficulty with optimization. But the purpose of this puzzle is to get the challenger into a dynamic of autonomous research, so as you said it’s not really difficult, you just have to find the right idea . Finally, as I want this research to be carried out independently, without assistance. So I think you’re listening and increasing the difficulty of this puzzle.
Thank you for your very good feedback, and I am attentive to other comments.
Magicien-d-oz

#27

This problem, should be moved to medium or remake test 4 to not need “smart”-optimize the code.
Test 1-3 is fine for any easy problem, because you can just code after the specs.
Test 4 you need to optimize, by finding repeats/cycles, that’s not an easy problem.

#28

Hello,
I have had this kind of request in the past and I will give the same explanation again. In itself this puzzle has nothing really complex (except optimization) so the only source of difficulty is optimization. In puzzles of medium difficulty it is not uncommon that the requested problem requires optimization AND another subtlety. So my puzzle is intended to be an introduction to optimization.