ruby challenge 6

now there are pairs

Challenge 6 presents you with the close up photo of the zipper on a pair of pants. In the page source you will find the word ‘zip’ and an arrow pointed at the url. If you change the ‘.html’ on the end to ‘.zip’ you will download a zip file that contains over 900 text files containing more nothing numbers. I guess that this puzzle and number 4; ‘follow the chain’ are supposed to be pairs, since  in both you follow a trail of ‘nothing’ numbers. Undoubtedly there will be more ‘pairs’. Eventually I came up with this script that produced more ascii art-text;

#!/usr/bin/ruby
require 'zip/zip'
nothing = 90052
comments = ""
Zip::ZipFile.open("./channel.zip", Zip::ZipFile::CREATE) {
     |zFi|
  while nothing > 0
    nNot = zFi.read(nothing.to_s + ".txt")
    comments += zFi.get_entry(nothing.to_s + ".txt").comment
    nothing = nNot.split("nothing is ")[1].to_i
  end
puts comments
}

This one took me a while, mostly because ruby’s documentation my ruby experience is somewhat lacking. I suppose that the more I use it the better a feel I will get for how the language is structured.

Next: challenge 7; smarty

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s