# [Community Puzzle] The weight of words

Coding Games and Programming Challenges to Code Better

Created by @Darazdeblek,validated by @papyjo,@FredericLocquet and @InSync.
If you have any issues, feel free to ping them.

I donâ€™t get the algorithm to decrypt.

Should you calculate the weight of each row/column in the beginning, before each step of before each rotation?

Ok, you have to calculate weights before each rotation.

Yes, the weights have to be calculated for the columns and the rows at each step but it seems like you figured it out

Hello, I canâ€™t figure this out.
@tglaria says:

• Method 1: you have to calculate weights before each rotation, so before each column rotation and before each row rotation (â€śon-the-flyâ€ť)

but you @Darazdeblek say:

• Method 2: the weights have to be calculated at each step, meaning (at least for me) that the weights need to be calculated before doing the rotations of all the columns and rows for the current step.

EDIT: Iâ€™ve walked through it on paper and compared with my algorithm, and found my mistake.
Indeed, you need to apply Method 1
Thanks for the cool puzzle! Itâ€™s really satisfying to see the decoded result once it works!

1 Like

I spent much longer on this than I should have because of a silly mistake.
Itâ€™s a great puzzle, but itâ€™s one where itâ€™s hard to figure out whatâ€™s going wrong, because even a slight mistake can make the output wildly wrong.

Please add to the Puzzle statement that the weights should be calculated before each rotation. This will save a lot of people from a lot of headaches.

To understand the description example, here are the steps

1. Step 1
• Afer column move :
YEOS
CDAE
• Afer row move :
YEOS
ECDA
2. Step 2
• Afer column move :
YEDS
ECOA
• Afer row move :
SYED
ECOA
3. Step 3
• Afer column move :
SYEA
ECOD
• Afer row move :
EASY
CODE

Thanks @RealSaitama - this helped me. Interestingly enough for this puzzle the main challenge is to get it right at least once - once you manage to get the first case right, the rest will also succeed (at least, that is my impression).
I think it would help this puzzle if as a first case, a case is included with n=1. Currently you either get the decryption right and solve the whole puzzle, or you get it wrong but there is no way to check whether you made a coding mistake or an interpretation mistake.

To understand the first case even more, step 1 in detail:

• Start grid:
YDOS
CEAE
• Weights of columns: Y + C = 89 + 67 = 156; D + E = 137, O + A = 144, S + E = 152. Hence, characters in those columns must move down 156, 137, 144 and 152 steps, respectively.
• Result after this column move:
YEOS
CDAE
• Weight of these rows: Y + E + O + S = 320; C + E + A + E = 269. Hence, characters of those rows must move right 320 and 269 steps, respectively.
• Result after this row move:
YEOS
ECDA