433.rb

Feb 25, 2009 22:52

I have created a command line client to Petri Purho's controversial game 4 Minutes and 33 Seconds of Uniqueness. It prints a "." every two seconds while playing. Its exit status will be zero if you win, otherwise it will be one. It is written in ruby. Its permanent home is this gist. You can download the code here.
This is it:

#!/usr/bin/env ruby -wKU
require 'net/http'
require 'uri'

STDOUT.sync = true; token = rand(28000); time = 0
uri_root = "http://www.kloonigames.com/nordicjam2009/"
start = URI.parse(uri_root + "new_game.php?v=#{token}");
whois = URI.parse(uri_root + "whois.txt");
start = Net::HTTP.get(start)
if ! start =~ /1/ then puts ""; exit 1; end

while (true)
if time >= 273 then puts ""; exit 0 end
who = Net::HTTP.get(whois); me = who.split("|")
if me[1].strip.to_i != token then puts ""; exit 1 end
print "."; sleep 2; time += 2
end
Code licensed under the WTFPL.

geekery, art

Previous post Next post
Up