Skip to content

Instantly share code, notes, and snippets.

@codesnik
Created February 11, 2010 06:39
Show Gist options
  • Save codesnik/301284 to your computer and use it in GitHub Desktop.
Save codesnik/301284 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'net/http'
require 'uri'
TEST_URL = URI.parse('http://nazva.net/logic_test5/')
def correct?( q, a)
response = Net::HTTP.post_form( TEST_URL, { "q#{q}" => "#{q}#{a}"} )
response.body.include? '>1<'
end
for q in 1..70
puts "#{q}: #{ (1..3).find {|a| correct?(q,a) } }"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment