File: xtbot.6

package info (click to toggle)
xtris 1.14-6
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 232 kB
  • ctags: 585
  • sloc: ansic: 4,094; makefile: 67
file content (116 lines) | stat: -rw-r--r-- 3,520 bytes parent folder | download | duplicates (7)
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
.TH XTBOT 6 "Oct 13, 1996" "Roger Espel Llima"
.SH NAME
xtbot \- automatic player for xtris
.SH SYNOPSIS
.B xtbot
[ -help ] [ -n nick ] [ -quiet ] [ -test ] [ \fIserver.name\fR [ \fIport\fR ] ]
.SH OPTIONS
.TP
.BR "-help"
Prints out a summary of the command-line options
.B xtbot
recognizes.
.TP
.BR "-n"
Sets the nickname for the bot;  the nickname appears at the bottom of
the screen on 
.B xtris
clients.
.TP
.BR "-quiet"
Sets quiet mode:
.B xtbot
will not output any diagnostics or error messages.
.B xtris
always starts
.B xtbot
with this option.
.TP
.BR "-test"
Runs the bot in test mode: 
.B xtbot
will not connect to a server or show the game in progress, but will just
simulate 16 games as fast as it can and print stats on the number of lines
it did and the number of bricks it played.
.SH ARGUMENTS
.TP
.BR "server.name"
Specifies the machine on which an
.B xtris
server (\fBxtserv\fP)
runs.
.B xtbot
will connect to that server, and add itself to the game.  

If the server is not specified, 
.B xtbot
will attempt to connect to a server on localhost (127.0.0.1).  If no
server is running on localhost,
.B xtbot
will exit with an error message.
.TP
.BR "port"
Specifies the port to connect to, if the server was started on a port
other than the default (19503).
.SH DESCRIPTION
.B xtbot
is a robot (i.e an automatic player) for 
.B xtris, 
a synchronous multi-user version of Tetris.
.PP
.B xtbot
connects to an
.B xtris
server, registers itself as a bot, and simulates a game of Tetris whenever
a human player hits 'play'. 
.PP
The current version of xtbot uses a pretty good decision algorithm,
which usually does several thousand lines before losing, when playing
on its own.  When playing against a bot, though, the main limiting
factor is the speed, whic is why
.B xtbot 
purposefully waits a little before dropping each brick, so that humans
can compete speed-wise.
.PP
.B xtbot
is started automatically by
.B xtris,
with the option '-quiet', when a player presses the 'bot' button.
.PP
Running copies of
.B xtbot
can be killed either by clicking on their name from an
.B xtris
window, or by killing the process.
.PP
It is fairly easy to adapt
.B xtbot
to make your own bots based on your favorite decision algorithms.
For this the easiest way is to change the decision function in decide.c
while keeping the rest of the bot's skeleton (in xtbot.c).  See the
comments in decide.c, decide.h and xtbot.h for details about the
interface between these.  Alternatively, the protocol between the client
and the server is described in detail in the file PROTOCOL, so you can
make completely independent bots.
.SH ENVIRONMENT
The default algorithm for the bot depends on 6 coefficients to evaluate
each possible position of the piece.  You can set the environment
variables XTBOT_FRONTIER, XTBOT_HEIGHT, XTBOT_HOLE, XTBOT_DROP,
XTBOT_PIT, XTBOT_EHOLE.  See the file decide.c to see what they do.
.PP
The values for the coefficients that xtbot uses now were obtained with a
genetic algorithm using a population of 50 sets of coefficients,
calculating 16 generations in about 20 hours on 20-odd Sparc 
workstations.  This improved the average number of lines from 10,000 to
about 50,000.  The code used for this isn't nearly clean enough to
distribute in a release. If you're interesed, please e-mail the author 
privately.
.SH SEE ALSO
.BR xtris (6),
.BR xtserv (6)
.SH BUGS
None known; please report any bugs to the author.
.SH AUTHOR
.B xtbot
was written by Roger Espel Llima <roger.espel.llima@pobox.com>.