diff options
Diffstat (limited to 'lib/Enigmatic')
-rw-r--r-- | lib/Enigmatic/Rotor.pm | 10 | ||||
-rw-r--r-- | lib/Enigmatic/RotorBox.pm | 20 |
2 files changed, 20 insertions, 10 deletions
diff --git a/lib/Enigmatic/Rotor.pm b/lib/Enigmatic/Rotor.pm index 792c7b5..e0a3b97 100644 --- a/lib/Enigmatic/Rotor.pm +++ b/lib/Enigmatic/Rotor.pm @@ -1,6 +1,7 @@ package Enigmatic::Rotor; use DAKKAR::p 'class'; use Enigmatic::Types qw(WiringMap Letter RotorPos); +use MooseX::Types::Set::Object; has wiring => ( is => 'ro', @@ -14,6 +15,15 @@ has ring_setting => ( default => 0, ); +has notches => ( + isa => 'Set::Object', + coerce => 1, + handles => { + has_notch_at => 'member', + }, + default => sub { [] }, +); + with 'Enigmatic::Role::WithWiring'; sub map { diff --git a/lib/Enigmatic/RotorBox.pm b/lib/Enigmatic/RotorBox.pm index 08a6b22..57f0a47 100644 --- a/lib/Enigmatic/RotorBox.pm +++ b/lib/Enigmatic/RotorBox.pm @@ -17,16 +17,16 @@ has rotorset => ( sub _build_rotorset { my %rotors = ( - I => 'EKMFLGDQVZNTOWYHXUSPAIBRCJ', - II => 'AJDKSIRUXBLHWTMCQGZNPYFVOE', - III => 'BDFHJLCPRTXVZNYEIWGAKMUSQO', - IV => 'ESOVPZJAYQUIRHXLNFTGKDCMWB', - V => 'VZBRGITYUPSDNHLXAWMJQOFECK', - VI => 'JPGVOUMFYQBENHZRDKASXLICTW', - VII => 'NZJHGRCXMYSWBOUFAIVLPEKQDT', - VIII => 'FKQHTLXOCBJSPDZRAMEWNIUYGV', - Beta => 'LEYJVCNIXWPBQMDRTAKZGFUHOS', - Gamma => 'FSOKANUERHMBTIYCWLQPZXVGJD', + I => { wiring => 'EKMFLGDQVZNTOWYHXUSPAIBRCJ', notches => ['Q'] }, + II => { wiring => 'AJDKSIRUXBLHWTMCQGZNPYFVOE', notches => ['E'] }, + III => { wiring => 'BDFHJLCPRTXVZNYEIWGAKMUSQO', notches => ['V'] }, + IV => { wiring => 'ESOVPZJAYQUIRHXLNFTGKDCMWB', notches => ['J'] }, + V => { wiring => 'VZBRGITYUPSDNHLXAWMJQOFECK', notches => ['Z'] }, + VI => { wiring => 'JPGVOUMFYQBENHZRDKASXLICTW', notches => ['M','Z'] }, + VII => { wiring => 'NZJHGRCXMYSWBOUFAIVLPEKQDT', notches => ['M','Z'] }, + VIII => { wiring => 'FKQHTLXOCBJSPDZRAMEWNIUYGV', notches => ['M','Z'] }, + Beta => { wiring => 'LEYJVCNIXWPBQMDRTAKZGFUHOS', notches => [] }, + Gamma => { wiring => 'FSOKANUERHMBTIYCWLQPZXVGJD', notches => [''] }, ); $_ = Enigmatic::Rotor->new($_) for values %rotors; |