It works fine for me here. I hope you don't mind, Urban, I'll post the
script here so that Jason can see it, since he seems to have problems
accessing your server:

#!/usr/bin/env ruby
#
# Run bots one after the other on CGOS. The BOTS variable is an array
# if directories of the bots. In each of these directory there has to
# be an executable file called 'cgos.sh' that connects the bot to CGOS.
# This executable is also required to set the sentinel file name to the
# one given in the TERM variable below.

# Number of games for each bot
GAMES = 1
# The bots that should play
BOTS = ["libEGO-AMAF", "libEGO-AMAF-2", "libEGO-AMAF-3"]
# Sentinel filename to be used by CGOS
TERM  = "stop.txt"

round = 0

if ARGV.length > 0 and ARGV.first == "stop"
  File.new(TERM, "w")
  exit
end

# Clean up (if script wasn't terminated correctly)
(BOTS+["."]).each do |dir|
  Dir.chdir do
    File.delete(TERM) if File.exists?(TERM)
  end
end

until(File.exists?(TERM))
  dir = BOTS[round % BOTS.length]
  puts "[#{Time.now}] Round #{round+1}"
  puts "[#{Time.now}] Running '#{dir}' for #{GAMES} games"
  last_was_print = false
  Dir.chdir(dir) do
    games = 0
    IO.popen('./cgos.sh 2>/dev/null') do |pipe|
      until(pipe.eof?)
        line = pipe.gets
        if line =~ /setup/
          games += 1
          File.new(TERM, "w") if games >= (GAMES-1)
        end
        case line
        when /gameover/
          line =~ /gameover\s+\d\d\d\d-\d\d-\d\d\s+(\S+)/
          print "\n" if last_was_print
          puts "[#{Time.now}] #{$1}"
          last_was_print = false
        when /setup/
          line =~ /setup\s+.*?(\S+\(.*\)\s+\S+\(.*\))/
          print "\n" if last_was_print
          puts "[#{Time.now}] #{$1}"
          last_was_print = false
        when /info/
          print "."
          STDOUT.flush
          last_was_print = true
        end
      end
    end
    File.delete(TERM)
  end
  round += 1
end
File.delete(TERM)



On 10/10/07, Jason House <[EMAIL PROTECTED]> wrote:
>
> I get:
> 500 - Internal Server Error
> I've wanted something like what you describe for running bots on CGOS and
> KGS.  When I do see the script, I'll see what I can do about hacking in KGS
> support to it.
>
>
> On 10/10/07, Urban Hafner <[EMAIL PROTECTED]> wrote:
> >
> > Hej all,
> >
> > for those of you that also have the problem that they have more than one
> > bot they want to run on CGOS, but only have one bot available: I've
> > written a small script that automatically rotates your bots (so that
> > each plays N games). It's available at
> > http://bettong.net/articles/2007/10/10/cgos-rotation-script
> >
> > Cheers,
> >
> >    Urban
> >
>
>
> _______________________________________________
> computer-go mailing list
> computer-go@computer-go.org
> http://www.computer-go.org/mailman/listinfo/computer-go/
>
_______________________________________________
computer-go mailing list
computer-go@computer-go.org
http://www.computer-go.org/mailman/listinfo/computer-go/

Reply via email to