diff --git a/templates/enigma_machine_emulator.cxx b/templates/enigma_machine_emulator.cxx index 358e3c3..fbd14f6 100644 --- a/templates/enigma_machine_emulator.cxx +++ b/templates/enigma_machine_emulator.cxx @@ -1,33 +1,74 @@ -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] +output[input('D/E: ')] +if input(ln[1]) = 'E': + output[input('E: ')] + output[input('R: ')] + + const[r.input] = input(ln[4]) + const[r.rot.1] = 'MNBVCZASDFGHJKLPOIUYTREWQ' + const[r.rot.2] = 'QWERTYUIOPKJHGFDSAZXCVBNN' + const[r.rot.3] = 'OKMIJNUHBYGVTGVCFXZADEWQA' + + const[X] = function[seperate(input(ln[3]) + + 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[3]))] + + const[X3] = function[math.randomize(char=r.input..true)] + const[X4] = function[math.power(X3).num(input(ln[3]))] + + const[X4] = function[math.randomize(char=r.input..true)] + const[X5] = function[math.power(X4).num(input(ln[3]))] + + const[X6] = function[merge(all.instances(X5))] + + output[X6] +if input(ln[1]) = 'D': + output[input('E: ')] + output[input('R: ')] + + const[r.input] = input(ln[39]) + const[r.rot.1] = 'MNBVCZASDFGHJKLPOIUYTREWQ' + const[r.rot.2] = 'QWERTYUIOPKJHGFDSAZXCVBNN' + const[r.rot.3] = 'OKMIJNUHBYGVTGVCFXZADEWQA' + + const[X] = function[seperate(input(ln[40]) + const[math.un_random] = math.esot.revert.probability.randomness.function + + 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.un_random(char=r.input..true)] + const[X2] = function[math.root(X1).num(input(ln[30]))] + + const[X3] = function[math.un_random(char=r.input..true)] + const[X4] = function[math.root(X3).num(input(ln[30]))] + + const[X4] = function[math.un_random(char=r.input..true)] + const[X5] = function[math.root(X4).num(input(ln[30]))] + + const[X6] = function[merge(all.instances(X5))] + + output[X6]