Mercurial > public > cpp-enigma
comparison enigma/machine.h @ 8:b90a41f0cd94
Created enigma_machine::army_str() & navy_str() functions for logging.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Fri, 29 Jun 2012 20:29:41 -0500 |
parents | db1216d380b3 |
children | da231533c5c7 |
comparison
equal
deleted
inserted
replaced
7:db1216d380b3 | 8:b90a41f0cd94 |
---|---|
123 return result; | 123 return result; |
124 } | 124 } |
125 | 125 |
126 // for access to the plugboard for hill-climbing, etc | 126 // for access to the plugboard for hill-climbing, etc |
127 plugboard& get_plugboard() { return pb; } | 127 plugboard& get_plugboard() { return pb; } |
128 | |
129 // Returns a string representation of the enigma machine's state. Useful | |
130 // for logging, etc: | |
131 // | |
132 std::string army_str() const { return str(true); } | |
133 std::string navy_str() const { return str(false); } | |
128 | 134 |
129 private: | 135 private: |
130 rotor_vector rotors; | 136 rotor_vector rotors; |
131 std::unique_ptr<rotor> reflector; | 137 std::unique_ptr<rotor> reflector; |
132 plugboard pb; | 138 plugboard pb; |
186 pos = r->signal_out(pos); | 192 pos = r->signal_out(pos); |
187 } | 193 } |
188 | 194 |
189 return pb.signal(pos); | 195 return pb.signal(pos); |
190 } | 196 } |
197 | |
198 std::string str(bool army) const; | |
191 }; | 199 }; |
192 } | 200 } |
193 | 201 |
194 #endif | 202 #endif |