[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnugo-devel] Small bug with restricted_genmove command - can be fixed c

From: pnprog
Subject: [gnugo-devel] Small bug with restricted_genmove command - can be fixed changing GTP_BUFSIZE constant
Date: Sat, 26 Feb 2011 07:58:45 +0100 (CET)
User-agent: SquirrelMail/1.4.15

Dear sir or madam,

I have been using GNU Go for the very beginning I started playing go. GNU
Go implementation of go text protocol includes many useful commands for
regression. Those commands can also be very useful to learn go, and I have
made my own GUI to take advantage of them.

In this context, I am making heavy use of the restricted_genmove command.
It allows to force GNU Go playing among a restricted set of intersections.
I used this behavior to implement a tsumego solver using GNU Go, and also
to query GNU Go about is 5 best moves at a given position.

But I am facing a small bug using this command

To illustrate it, let us imagine I am playing with GNU Go on 7x7 goban,
and i want to prevent GNU Go playing its first move on tengen: D4

The command will be:

restricted_genmove black A1 A2 A3 A4 A5 A6 A7 B1 B2 B3 B4 B5 B6 B7 C1 C2
C3 C4 C5 C6 C7 D1 D2 D3 D5 D6 D7 E1 E2 E3 E4 E5 E6 E7 F1 F2 F3 F4 F5 F6 F7
G1 G2 G3 G4 G5 G6 G7

This will work just fine.

Now, let us imagine I want to do the same on a 19x19 goban. The command
preventing GNU Go playing on tengen (K10) will be:

restricted_genmove white  A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14
A15 A16 A17 A18 A19 B1 B2 B3 B4 B5 B6 B7 B8 B9 B10 B11 B12 B13 B14 B15 B16
B17 B18 B19 C1 C2 C3 C4 C5 C6 C7 C8 C9 C10 C11 C12 C13 C14 C15 C16 C17 C18
C19 D1 D2 D3 D4 D5 D6 D7 D8 D9 D10 D11 D12 D13 D14 D15 D16 D17 D18 D19 E1
E2 E3 E4 E5 E6 E7 E8 E9 E10 E11 E12 E13 E14 E15 E16 E17 E18 E19 F1 F2 F3
F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15 F16 F17 F18 F19 G1 G2 G3 G4 G5
G6 G7 G8 G9 G10 G11 G12 G13 G14 G15 G16 G17 G18 G19 H1 H2 H3 H4 H5 H6 H7
H8 H9 H10 H11 H12 H13 H14 H15 H16 H17 H18 H19 J1 J2 J3 J4 J5 J6 J7 J8 J9
J10 J11 J12 J13 J14 J15 J16 J17 J18 J19 K1 K2 K3 K4 K5 K6 K7 K8 K9 K11 K12
K13 K14 K15 K16 K17 K18 K19 L1 L2 L3 L4 L5 L6 L7 L8 L9 L10 L11 L12 L13 L14
L15 L16 L17 L18 L19 M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 M12 M13 M14 M15 M16
M17 M18 M19 N1 N2 N3 N4 N5 N6 N7 N8 N9 N10 N11 N12 N13 N14 N15 N16 N17 N18
N19 O1 O2 O3 O4 O5 O6 O7 O8 O9 O10 O11 O12 O13 O14 O15 O16 O17 O18 O19 P1
P2 P3 P4 P5 P6 P7 P8 P9 P10 P11 P12 P13 P14 P15 P16 P17 P18 P19 Q1 Q2 Q3
Q4 Q5 Q6 Q7 Q8 Q9 Q10 Q11 Q12 Q13 Q14 Q15 Q16 Q17 Q18 Q19 R1 R2 R3 R4 R5
R6 R7 R8 R9 R10 R11 R12 R13 R14 R15 R16 R17 R18 R19 S1 S2 S3 S4 S5 S6 S7
S8 S9 S10 S11 S12 S13 S14 S15 S16 S17 S18 S19 T1 T2 T3 T4 T5 T6 T7 T8 T9
T10 T11 T12 T13 T14 T15 T16 T17 T18 T19

This time it won't work because the length of the command exceeds 1000
characters which is the limit hard-coded inside GNU Go.
GNU Go will interpret the first 1000 characters as a commands, and then
try to interpret the 294 remaining characters as a second command, and

The easy way to fix this bug is to increase the command max length. This
can be done by changing the value of GTP_BUFSIZE constant in
interface/gtp.h file at line 48:

/* Maximum allowed line length in GTP. */
#define GTP_BUFSIZE 1000

I would recommend setting GTP_BUFSIZE at 2300 which corresponds to the
restricted_genmove command allowing to play everywhere on a 25x25 goban.

I know I am probably the only person needed such a big value. I downloaded
the source of GNU Go and fixed and compiled it for my personal use. But
since I started to distribute my GUI as free software (see I wish I can also release the last version
using the restricted_genmove command.

This bug is present on GNU Go 3.8 (the one I use) but also GNU Go 3.9.X

Best regards,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]