Advance rotor by count positions

Default value of parameter is 1
This commit is contained in:
Eryn Wells 2015-07-18 10:39:25 -07:00
parent f4b3982986
commit 9f2106ed94

View file

@ -36,8 +36,8 @@ class Rotor {
self.series = series
}
func advance() {
position = position.successor() % Rotor.alphabet.count
func advance(count: Int = 1) {
position = (position + count) % Rotor.alphabet.count
}
func encode(c: Character) throws -> Character {