diff --git a/templates/enigma_machine_emulator.cxx b/templates/enigma_machine_emulator.cxx new file mode 100644 index 0000000..358e3c3 --- /dev/null +++ b/templates/enigma_machine_emulator.cxx @@ -0,0 +1,33 @@ +output[input('E: ')] +output[input('R: ')] + +const[r.input] = input(ln[2]) +const[r.rot.1] = 'MNBVCZASDFGHJKLPOIUYTREWQ' +const[r.rot.2] = 'QWERTYUIOPKJHGFDSAZXCVBNN' +const[r.rot.3] = 'OKMIJNUHBYGVTGVCFXZADEWQA' + +const[X] = function[seperate(input(ln[1]) + +if r.input = 1 + r.rot.1 = true + r.rot.2 = false + r.rot.3 = false +if r.input = 2 + r.rot.1 = false + r.rot.2 = true + r.rot.3 = false +if r.input = 3 + r.rot.1 = false + r.rot.2 = false + r.rot.3 = true + +const[X1] = function[math.randomize(char=r.input..true)] +const[X2] = function[math.power(X1).num(input(ln[1]))] + +const[X3] = function[math.randomize(char=r.input..true)] +const[X4] = function[math.power(X3).num(input(ln[1]))] + +const[X4] = function[math.randomize(char=r.input..true)] +const[X5] = function[math.power(X4).num(input(ln[1]))] + +output[X5]