dragongoserver
Get Version
0.3.0What
The dragongoserver gem allows you to use the Go Server (DragonGoServer) from ruby programs.
Installing
sudo gem install dragongoserver
The basics
You can:
- get your username at DGS
- get your rank at DGS
- get the games where you have to move
- get all running games
- etc.
You get a command-line program name ‘dgs’ which can be called with different options and a rubygems library which can be used in your own Ruby scripts.
To use this gem you have to set the language of your DGS-Account to english.
Demonstration of usage
Usage as a rubygems library
First you have to set the following environment variables:
DGS_USERNAME="myname"
DGS_PASSWORD="mypassword"
This can be done by inserting the following two line into your .bashrc file (or a similar startup file for your preferred shell).
export DGS_USERNAME="myname"
export DGS_PASSWORD="mypassword"
Alternatively you can pass the username and password to every call of the
Dgs.new method:
mydgs = Dgs.new("myname","mypassword")
Some examples
require 'rubygems'
require 'dragongoserver'
dgs = Dgs.new
dgs.username # prints your username at DGS
dgs.waiting_games # prints your waiting games:
# => [369607, 369303, 369412]
dgs.get_rank # your rank as a GoRank object
# => #<GoRank:0xb7a66514 @kd=:kyu, @num="26">
dgs.get_rank.to_s # your rank as a string
# => "26 kyu"
Usage of the commandline script
$ dgs -v
dgs 0.0.3
outputs the version of the installed dragongoserver gem
dgs --help
outputs a help of the dgs-script with all current implemented options
dgs --waiting
prints a list of games where you have to make your next move
You can open a shell, type in the following commands and watch when you have to move in a waiting game.
Of course you can also write a shellscript with these commands.
while true
do
dgs --waiting
date
sleep 300
done
Instead of the script above you can use the ‘—waiting-loop’ feature of this gem:
dgs --waiting-loop
in an endless loop prints a list of games where you have to make your next move.
The duration until the next request is made at DGS will be dynamically adjusted. It starts with every 60 seconds and will be increased if there are no new moves in this period.
If you want the messages display in big red letters as an On-Screen-Display:
dgs --waiting-loop --osd
Documentation
Forum
http://groups.google.com/group/dragongoserver_gem
How to submit patches
Read the 8 steps for fixing other people’s code and for section 8b: Submit patch to Google Groups, use the Google Group above.
The trunk repository is svn://rubyforge.org/var/svn/dragongoserver/trunk for anonymous access.
License
This code is free to use under the terms of the MIT license.
Contact
Comments are welcome. Send an email to Thomas Preymesser or via the forum
Support the development of this project
Thomas Preymesser, 31st December 2008
Theme extended from Paul Battley