-
Notifications
You must be signed in to change notification settings - Fork 1
/
qrobot
executable file
·71 lines (55 loc) · 2.13 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
67
68
69
70
#! /usr/bin/perl -w
# DGS Robot: A robot skeleton for dragongoserver.net
# Copyright (C) 2006-2015 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 => 0,
dont_move => 0,
logging => 1,
sgffile => "/tmp/qsgf",
sgfout => "/tmp/qout.sgf",
finished_games => "qfinished.lst",
error_games => "qerror.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 {
my ($b) = $_[0];
(($b->opp_started_games <= 5)
and ($b->boardsize >= 13) and ($b->boardsize <= 19))
or not $b->rated
or ($b->game_type != "GO")
},
badsize_msg => "I am sorry, I only play board sizes 13 to 19, and no more than 5 games per user at a time. If you want to play smaller than 13, I'll only accept a non-rated game. Also, I only play normal Go games, no team go or others.",
# 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;