Challenge: I am working on creating arrays to store values and iterate until a specific value is reached. Ultimately, this code will be used to match one letter to another, similar to how the WWII Bombe machine functioned, but in a purely digital format. The Bombe machine was used to decode messages by mapping one letter to another. I am attempting to decrypt messages using this method.
Knowledge: My coding experience is limited, especially with google-apps-script. While I have a basic understanding, I struggle with syntax differences, like using Logger.log(data);
instead of System.out.print();
. I have made some progress, which you can find here.
Context: I realize this is a lot to take in, but please hear me out before dismissing my query. The link under "Enigma example" in the comment above showcases the reverse mapping I aim to achieve. However, I am stuck on creating loops and variables. I have gathered information on the Enigma and Bombe machines, which you can access here. My searches online have been futile, only leading me to basic loop examples.
Assistance Needed: I require help with creating loops, variables, and arrays. Suggestions and guidance are invaluable to me as my goal is to learn rather than have my work completed by others.
Concepts: Some concepts I am considering are garbage collectors, multi-dimensional arrays, and exploring different sequences of possibilities. For more details, refer to the "Enigma & Bombe info" link mentioned earlier.
For easier copying and pasting:
function bombeCode1() {
var fastRotor = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N",
"O","P","Q","R","S","T","U","V","W","X","Y","Z"];
var mediumRotor = fastRotor;
var slowRotor = fastRotor;
var rows = 26;
var columns = 26;
for (var i=0; i < rows ; i++) {
Logger.log('Outer Loop: value of i : ' + i);
var fastRotorValue = fastRotor[i];
for (var j=0; j < columns ; j++) {
Logger.log('-Inner Loop value of j : ' +j);
var medRotorValue = mediumRotor[j];
for (var k=0; k < 26 ; k++) {
var slowRotorValue = slowRotor[k];
Logger.log("---- XXXX " + fastRotorValue + " " + medRotorValue + " " + slowRotorValue);
};
}
}
}