-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
78 lines (65 loc) · 2.64 KB
/
main.cpp
File metadata and controls
78 lines (65 loc) · 2.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#include <iostream>
#include <fstream>
#include <vector>
#include "enigma.h"
#include "errors.h"
using namespace std;
//thought process here is that the steer is towards using friend functions.
int main(int argc, char** argv)
{
// check if there are more than 3 different arguments
// if (argc < 4)
// {
// cout << "You need to have more than 3 different arguments" << endl;
// }
plugBoard plugBoard;
cout << "PB VALUES: "<< endl;
check_error(plugBoard.readFile("plugboards/I.pb"));
//need to create a function here for plugboard to reflect values
// plugBoard.readFile(argv[1]);
reflector reflector;
cout << "RF VALUES: "<< endl;
check_error(reflector.readFile("reflectors/I.rf"));
//need to create a function here for plugboard to reflect values
// reflector.readFile(argv[2]);
rotor rotorArray[3];
check_error(rotorArray[0].readFile("rotors/IV.rot"));
check_error(rotorArray[1].readFile("rotors/III.rot"));
check_error(rotorArray[2].readFile("rotors/II.rot"));
//TBC: Check number of rotor values
// //declare an array of rotors
// rotor rotorArray[3];
// // for(int i = 0; i < 3; i++)
// // {
// // rotorArray[i].readFile;
// // }
// check_error(rotorArray[0].readFile("rotors/shift_up.rot", intermediateOutput.rotorValues[0], intermediateOutput.rotorNotches[0]));
// // check_error(rotorArray[1].readFile("rotors/II.rot", intermediateOutput.rotorValues[1], intermediateOutput.rotorNotches[1]));
// // check_error(rotorArray[2].readFile("rotors/III.rot", intermediateOutput.rotorValues[2], intermediateOutput.rotorNotches
// // [2]));
//copy rotorcount to transformer
//use the rotor array to get the final value to be accessed.
//check file for entry
inputText inputText;
check_error(inputText.readFile("input.txt"));
// // check_error(inputText.readFile((argc-1));
// for (unsigned int i = 0; i < inputText.input.size(); i++)
// {
// cout<< inputText.input.at(i);
// }
intermediateOutput intermediateOutput;
//copy rotorarray into machine to be modified
intermediateOutput.copy(rotorArray, 3);
intermediateOutput.rotorPositionInput("rotors/III.pos");
intermediateOutput.transform(argc, inputText, plugBoard, reflector);
for(unsigned int i = 0; i < intermediateOutput.output.size(); i++)
{
cout << intermediateOutput.output.at(i);
}
// intermediateOutput.transformNoPBRF(argc, inputText);
//
// outputText outputText;
// check_error(outputText.outputFile("output.txt", intermediateOutput.output));
// check_error(inputText.outputFile((argc));
return 0;
}