ruby challenge 2


The second Python challenge presents a picture of a book and the hint;

recognize the characters. maybe they are in the book,

but MAYBE they are in the page source.

In the page source you find a huge mess of symbols, having solved this before I knew that there was a text message buried in there. Previously I simply replaced each common symbol with nothing which eventually revealed the message. This time I went the other direction.

mess=''' <-- a huge mess of symbols for a thousand or so lines -->'''
i = 0
message = ""
mess.length.times do
  if mess[i,1] =~ /^[a-z]/
    message = message + mess[i,1]
i += 1
puts message

And this brings us to challenge 3 and the picture of the candles.

** edit

After completing that one I got to thinking about how similar the two challenges are, they both deal with string methods. I figured I could probably apply the one-liner from the first challenge and came up with this;

puts ‘!~@#$%^&*()_+[]{}’+”\n”, “”

This is basically the first aproach I took when solving this puzzle with python, though I think that it is a lot more susinct. It took me a minute to figure out the newline problem, single quotes mangle the newline , but double quotes don’t escape the special symbols.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s