Hello, I have a doubt, I need to exchange letters with the blocks
I have this code (It is a city)
The way it is encrypted is as follows:
• the letter “a” represents the “Z”,
• “b” represents “Y”,
• “c” represents “X”,
•… successively until reaching
• the “y” represents the “B”,
• “z” represents “A”.
The city is Stoke on Trent
But I don’t know how I can make the blocks swap the letters.
I hope someone can help me thank you very much

I would love to help you. I’ll try to do this tonight if nobody is able to help you out!

1 Like

Do you want the user to click on a blank block and have the better above/below it change to the correct letter (so b is replaced by Y)? Or do you want the user to click a button and the entire city name changes?

1 Like

Thank you! :slight_smile:

I think like the first idea, replacing, I mean that if you type BCKL it changes to yxpo when you click a button, or in this case, you are given a variable with an encrypted code (HGLPV LM GIVMG) when you click a button the blocks change the letters to (Stoke on Trent), based on the letter “a” representing the “Z”,“b” represents “Y”, “c” represents “X”, “z” represents “A”, and so on :slight_smile:

Here’s a demo:



here’s another demo (remixed from the demo of @tatiang - clever strategy! thanks!)
i noticed that the encoding / decoding is the same in either direction.
so i’ve modified it so the entry you make is encoded into the input field after the button is pressed. and when you press the button again, it encodes/decodes it back! (the only thing this demo does not do is return the result in lower case - sorry).


if you still want 2 separate functions then use a table of lower case alphabet in the decode, but use a table of uuper case alphabet for encode - with two separate buttons calling the correct method.


Thanks everyone for helping :slight_smile:

1 Like