Add MultiBombe

Runs the Bombe multiple times with different rotor specs.
Edits the core BombeMachine a little to add the ability to switch rotors
without rewiring everything
This commit is contained in:
s2224834 2019-01-10 18:04:02 +00:00
parent 8c757d1e03
commit 3eb44708e5
7 changed files with 411 additions and 13 deletions

View file

@ -84,6 +84,7 @@ import "./tests/ParseTLV";
import "./tests/Media";
import "./tests/Enigma";
import "./tests/Bombe";
import "./tests/MultipleBombe";
// Cannot test operations that use the File type yet
//import "./tests/SplitColourChannels";

View file

@ -85,7 +85,7 @@ TestRegister.addTests([
{
name: "Bombe: 4 rotor",
input: "LUOXGJSHGEDSRDOQQX",
expectedMatch: /LHSC \(plugboard: SS\)/,
expectedMatch: /LHSC \(plugboard: SS\): HHHSSSGQUUQPKSEKWK/,
recipeConfig: [
{
"op": "Bombe",

View file

@ -0,0 +1,47 @@
/**
* Bombe machine tests.
* @author s2224834
* @copyright Crown Copyright 2019
* @license Apache-2.0
*/
import TestRegister from "../TestRegister";
TestRegister.addTests([
{
name: "Multi-Bombe: 3 rotor",
input: "BBYFLTHHYIJQAYBBYS",
expectedMatch: /LGA \(plugboard: SS\): VFISUSGTKSTMPSUNAK/,
recipeConfig: [
{
"op": "Multiple Bombe",
"args": [
// I, II and III
"User defined", "EKMFLGDQVZNTOWYHXUSPAIBRCJ<R\nAJDKSIRUXBLHWTMCQGZNPYFVOE<F\nBDFHJLCPRTXVZNYEIWGAKMUSQO<W",
"User defined", "",
"User defined", "AY BR CU DH EQ FS GL IP JX KN MO TZ VW", // B
"THISISATESTMESSAGE", 0,
]
}
]
},
/*
* This is too slow to run regularly
{
name: "Multi-Bombe: 4 rotor",
input: "LUOXGJSHGEDSRDOQQX",
expectedMatch: /LHSC \(plugboard: SS\): HHHSSSGQUUQPKSEKWK/,
recipeConfig: [
{
"op": "Multiple Bombe",
"args": [
// I, II and III
"User defined", "EKMFLGDQVZNTOWYHXUSPAIBRCJ<R\nAJDKSIRUXBLHWTMCQGZNPYFVOE<F\nBDFHJLCPRTXVZNYEIWGAKMUSQO<W",
"User defined", "LEYJVCNIXWPBQMDRTAKZGFUHOS", // Beta
"User defined", "AE BN CK DQ FU GY HW IJ LO MP RX SZ TV", // B thin
"THISISATESTMESSAGE", 0,
]
}
]
},
*/
]);