Skip to content

Instantly share code, notes, and snippets.

@goodbedford
Last active August 29, 2015 14:13
Show Gist options
  • Select an option

  • Save goodbedford/136ee9bae907d21cc54a to your computer and use it in GitHub Desktop.

Select an option

Save goodbedford/136ee9bae907d21cc54a to your computer and use it in GitHub Desktop.
problem
phrase5 = "oh i understand banter"
phrase6 = "a ob ooc dd oeoo ooooof"
phrase7 = "a b c"
phrase8 = "a b c d e f g"
def decryptc(message)
m = message.split()
puts "Phase3: Extra-Credit"
puts "Message: #{message}"
#puts "Unscrambled: #{unscramble3(m)}"
puts "Unscrambled: #{test_arry2(m) }"
puts
end
def test_arry2(arry)
puts "TEST SUITE - PART2"
unscrambled_word = ""
word_position = 1
current_word = arry[word_position -1]
letter = ""
nxt_letter =""
while( word_position <= arry.size) do
if (word_position > current_word.size)
nxt_letter = word_position - current_word.size
word_position += 1
current_word = arry[word_position - 1]
while ( nxt_letter > current_word.size) do
word_position += 1
nxt_letter -= 1
current_word = arry[word_position - 1]
end #while
letter = current_word[nxt_letter -1]
unscrambled_word << letter
word_position +=1
current_word = arry[word_position - 1]
else
current_word = arry[word_position - 1]
letter = current_word[word_position - 1]
unscrambled_word << letter
word_position += 1
current_word = arry[word_position - 1]
end #if word_position
end #while
unscrambled_word
end #test_arry2
@goodbedford

Copy link
Copy Markdown
Author

I just finished this and my wife is happy.

@goodbedford

Copy link
Copy Markdown
Author

sorry it doesnt work. she is still happy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment