Alex P. (wetzel) wrote,
Alex P.

  • Music:


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 = ""
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
Code licensed under the WTFPL.
Tags: art, geekery
  • Post a new comment


    Comments allowed for friends only

    Anonymous comments are disabled in this journal

    default userpic

    Your IP address will be recorded