forked from yrutschle/DGSLib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathqrobot
executable file
·67 lines (51 loc) · 1.9 KB
/
qrobot
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#! /usr/bin/perl -w
# DGS Robot: A robot skeleton for dragongoserver.net
# Copyright (C) 2006-2012 Yves Rutschle
#
# This program is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public
# License as published by the Free Software Foundation;
# either
# version 2 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more
# details.
#
# The full text for the General Public License is here:
# http://www.gnu.org/licenses/gpl.html
use strict;
use DGSQBot;
my $bot = new DGSQBot(
name => "GnuGo",
verbose => 1,
dont_move => 0,
logging => 1,
sgffile => "/tmp/qsgf",
sgfout => "/tmp/qout.sgf",
finished_games => "qfinished.lst",
logfile => "qrobot.log",
throttle_file => "/tmp/qrobot.throttle",
pidfile=> "/tmp/qrobot.pid",
login=>'whiterobot',
passwd=>`cat passwd.qrobot`, # Retrieve password from external file; password can also just be set here.
cookies => "$ENV{HOME}/.qrobot.cookies",
gtp_engine => "/usr/games/gnugo --mode gtp",
# board_ok a callback to check the board size is
# acceptable for this robot. if it isn't, the invite is
# rejected with the badsize_msg.
# It must return 1 to accept the invite, 0 otherwise.
board_ok => sub {
($_[0]->boardsize >= 13) and ($_[0]->boardsize <= 19)
or not $_[0]->rated
},
badsize_msg => "I am sorry, I only play board sizes 13 to 19. If you want to play smaller than 13, I'll only accept a non-rated game.",
# pre_run is called after loading the sgf, before
# computing the move.
pre_run => sub {},
);
die "Error starting the engine\n" unless defined $bot;
$bot->do_everything;