aboutsummaryrefslogtreecommitdiff
path: root/challenge-135/abigail/lua
diff options
context:
space:
mode:
authorAbigail <abigail@abigail.be>2021-10-19 22:02:01 +0200
committerAbigail <abigail@abigail.be>2021-10-19 22:02:01 +0200
commit3f9069255c9ab3f2a600ce465fa08e2cb2edc57d (patch)
treee616e6fad087a1aed1d693542c50acf01e94eeec /challenge-135/abigail/lua
parent32ffa2beeb07181afb6af80ebd749bb8629bf636 (diff)
downloadperlweeklychallenge-club-3f9069255c9ab3f2a600ce465fa08e2cb2edc57d.tar.gz
perlweeklychallenge-club-3f9069255c9ab3f2a600ce465fa08e2cb2edc57d.tar.bz2
perlweeklychallenge-club-3f9069255c9ab3f2a600ce465fa08e2cb2edc57d.zip
Might as well map 'A' to 0.
The SEDOL specification says 'A' maps to 10, 'B' to 11, etc. However, to perform a checksum, all we care about is module 10 arithmetic. So, whether 'A' maps to 10, or to 0, doesn't matter.
Diffstat (limited to 'challenge-135/abigail/lua')
-rw-r--r--challenge-135/abigail/lua/ch-2.lua2
1 files changed, 1 insertions, 1 deletions
diff --git a/challenge-135/abigail/lua/ch-2.lua b/challenge-135/abigail/lua/ch-2.lua
index d979fbe2a0..a8c89f57dc 100644
--- a/challenge-135/abigail/lua/ch-2.lua
+++ b/challenge-135/abigail/lua/ch-2.lua
@@ -21,7 +21,7 @@ for line in io . lines () do
local byte = string . byte (line : sub (i, i))
if byte <= string . byte ("9")
then byte = byte - string . byte ("0")
- else byte = byte - string . byte ("A") + 10
+ else byte = byte - string . byte ("A")
end
check = check + w [i] * byte
end