projects
/
cipher-training.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
f24be00
)
Tweaked the keyword break slides
author
Neil Smith
<neil.git@njae.me.uk>
Mon, 23 Jun 2014 16:25:12 +0000
(17:25 +0100)
committer
Neil Smith
<neil.git@njae.me.uk>
Mon, 23 Jun 2014 16:25:12 +0000
(17:25 +0100)
slides/keyword-break.html
patch
|
blob
|
history
diff --git
a/slides/keyword-break.html
b/slides/keyword-break.html
index 4a2772c03ddfad8a2ece4bfee7b8f5b086c4be47..49160bbb4fe394a3a5f9d88a05a797c62b732372 100644
(file)
--- a/
slides/keyword-break.html
+++ b/
slides/keyword-break.html
@@
-86,6
+86,28
@@
But before we get there, a couple of diversions...
---
---
+# DRYing code
+
+Three cipher breaking tasks so far.
+
+All working on the same principle:
+
+```
+find a way to enumerate all the possible keys
+initialise 'best so far'
+for each key:
+ decipher message with this key
+ score it
+ if it's better than the best so far:
+ update best so far
+```
+
+Repetition of code is a bad smell.
+
+Separate the 'try all keys, keep the best' logic from the 'score this one key' logic.
+
+---
+
# map()
A common task is to apply a function to each item in a sequence, returning a sequence of the results.
# map()
A common task is to apply a function to each item in a sequence, returning a sequence of the results.