How to write a program Polybius Square on JS?
There is a proposal to write a cycle in a cycle, start writing, throw your ideas.

function kvpol() { var kv = [ [1,"А","Б","В","Г","Д","Е"], [2,"Ё","Ж","З","И","Й","К"], [3,"Л","М","Н","О","П","Р"], [4,"С","Т","У","Ф","Х","Ц"], [5,"Ч","Ш","Щ","Ъ","Ы","Ь"], [6,"Э","Ю","Я",",",".","-"] ]; // а что дальше? Подскажите, пожалуйста }; 
  • And what for the square "Polybius" what is the formula what should be in the array after the execution of the code? - Rules
  • there is a squared alphabet, the letter is encoded by an index, ex: 45 4-line, 5-column - irina
  • And what did you fail? There, everything is very primitive in encryption mode. - ReinRaus
  • Could you throw off your program code, the cycles do not work and a couple more nuances did not work out - irina
  • How do you like this code? - Rules

1 answer 1

Here it is . Space specifically added, probably need without him, we will assume that you need to refine.

upd . Yes, this is an example of the first step. To implement the second step, depending on the choice of encryption method, you need to slightly modify these functions.

  • Almost, no matter what method of encryption is selected, the output should be text, not numbers. The wiki is described in detail. For example, hashcode => recursion - ReinRaus
  • Phew Well then, very well, I was very much afraid that I had completed the task for the TS =) It remains, as I understand it, to make a cyclic shift and execute the decode ... just uh-huh. - Yura Ivanov
  • +50! , I'll go eat something. - Oleg
  • Throw off if it is fashionable, the full code of the working program, I can not understand for 2 days - Irina