Mercurial > public > cpp-enigma
comparison enigma/plugboard.h @ 10:232dbe7a3fe0
Added plugboard::unplug_all().
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Fri, 29 Jun 2012 21:26:24 -0500 |
parents | f4e25e6b76c3 |
children |
comparison
equal
deleted
inserted
replaced
9:7362965f53b1 | 10:232dbe7a3fe0 |
---|---|
150 bool is_connected(int x, int y) | 150 bool is_connected(int x, int y) |
151 { | 151 { |
152 return wiring_map[x] == y && wiring_map[y] == x; | 152 return wiring_map[x] == y && wiring_map[y] == x; |
153 } | 153 } |
154 | 154 |
155 // Unplugs all cables | |
156 void unplug_all() | |
157 { | |
158 for (auto i = 0U; i < wiring_map.size(); ++i) | |
159 { | |
160 wiring_map[i] = i; | |
161 } | |
162 } | |
163 | |
155 private: | 164 private: |
156 alpha_int_array wiring_map; | 165 alpha_int_array wiring_map; |
157 | 166 |
158 // common constructor code: | 167 // common constructor code: |
159 void construct_wiring(const pair_vector& pairs); | 168 void construct_wiring(const pair_vector& pairs); |