I wrote this code.  Do with it as you please.

Gtp.rb
GtpTest.rb