More Lint-related changes

This commit is contained in:
Smaug123
2016-01-13 18:56:20 +00:00
parent 5247452e55
commit aebd353646
2 changed files with 11 additions and 11 deletions

View File

@@ -38,20 +38,20 @@ function next_solitaire(deckIn)
deck = rotateRight(deck,1)
end
# triple-cut
split = splitBy(deck, x -> x > 52)
split_deck = splitBy(deck, x -> x > 52)
if deck[1] > 52 && deck[end] > 52
1
# do nothing
elseif deck[1] > 52
split = rotateRight(split, 1)
split_deck = rotateRight(split_deck, 1)
elseif deck[end] > 52
split = rotateLeft(split, 1)
split_deck = rotateLeft(split_deck, 1)
else
inter = split[1]
split[1] = split[end]
split[end] = inter
inter = split_deck[1]
split_deck[1] = split_deck[end]
split_deck[end] = inter
end
deck = flatten(split)
deck = flatten(split_deck)
# take bottom of deck and put it just above last card
cardsToTake = (deck[end] > 52) ? 0 : deck[end]

View File

@@ -5,7 +5,7 @@ For example, encrypt_vigenere("ab", [0, 1]) returns "AC".
function encrypt_vigenere(plaintext, key::Array)
# plaintext: string; key: vector of integer offsets, so [0, 1] encrypts "ab" as "ac"
ans = [encrypt_caesar(char, key[(i-1) % length(key)+1]) for (i, char) in enumerate(letters_only(plaintext))]
ans = [encrypt_caesar(chr, key[(i-1) % length(key)+1]) for (i, chr) in enumerate(letters_only(plaintext))]
join(ans, "")
end
@@ -58,10 +58,10 @@ function crack_vigenere(plaintext; keylength=0)
decr = [crack_caesar(st)[1] for st in everyother]
ans = IOBuffer()
for i in 1:length(decr[1])
for column in 1:length(decr[1])
for j in 1:keylength
if i <= length(decr[j])
print(ans, decr[j][i])
if column <= length(decr[j])
print(ans, decr[j][column])
end
end
end