Skip to content
Little GolemMake your next move.

LG hex game format to anything-other-than-trmph?

Public forum discussion.

#1 · wccanard

14 Apr 2016

Hi. Having played a few games here now, I want to analyse them using tools other than trmph.

As far as I can see, this site can export a hex game in "hsgf" format. It can also upload it directly to trmph, where I can generate html links and a URL for a picture.

I would like to get games directly into HexGui (or more precisely benzene-HexGui). If I try and load the hsgf directly then there I have issues with colours; in two examples I've tried, the black and white edges stay the same but the black and white pieces get reversed (note that this is not just a superficial issue -- changing the colours of the stones but not of the edges completely changes the game). Currently my workaround for this is to just edit the hsgf file directly, but if I ever write a script which does, say, opening analysis of top games here (and in the past I have done this for dots-and-boxes and connect 4, so this is not a complete impossibility) then I don't really want to be hacking around with editing hsgf files.

I have heard that JHex offers even better analysis than HexGui but I have not looked into the option of using JHex to convert from LG/trmph to HexGui. Has anyone else?

Another option is a script which converts a URL from trmph directly into a format readable by HexGui. This would be another clunky option but it would be a partial solution for now at least.

Presumably others are aware that the hsgf files coming from this site do not seem quite compatible with HexGui. Has this problem been fixed already or am I going to have to do it myself? Or have I just made a mistake and everything's fine?

#2 · alihv

14 Apr 2016

I wrote a Slither bot and a Slither board once. Same thing, white and black are reversed indeed.

I don't expect this to be of help but (just in case) here is the layer between my bot and LG:

http://pastebin.com/iKFuVpnh

#3 · Carroll

14 Apr 2016

I did not find a description of the syntax awaited by Benzene hexgui, otherwise I would have thrown a simple script to convert LG syntax to it.

You may be able simply to change the function:

In hexgui/sgf/SgfReader.java

<div class="code_block" id="l156"><span class="cm">/** Parse a point or move value.</span><pre><div class="code_block" id="l157"><span class="cm">Supports both standard SGF notation for Hex (a1, ...) and Go-like</span><pre><div class="code_block" id="l158"><span class="cm">notation used by Little Golem (aa, ...) */</span><pre><div class="code_block" id="l159" style="background-color: rgb(255, 255, 153);"><span class="kd">private</span> <span class="n">HexPoint</span> <span class="nf">parsePoint</span><span class="o">(</span><span class="n">String</span> <span class="n">s</span><span class="o">)</span> <span class="kd">throws</span> <span class="n">SgfError</span><pre><div class="code_block" id="l159" style="background-color: rgb(255, 255, 153);"><br/><p></p></div></pre></div></pre></div></pre></div></pre></div>

#5 · wccanard

14 Apr 2016

Thanks Carroll. Nice to talk to you again after all these years, by the way! I don't think the problem is with the function you cite -- I could probably do some dirty hack where I just switch the two coordinates in that function, but then I'd have both the colours the wrong way round and the board the wrong way around, and I'd ultimately get even more confused :-) Thanks for the benzene link. I will have to decide the most sensible way to deal with these issues.

#7 · Tom Ace

21 Apr 2016

Sorry for being late to this thread--I haven't been checking the forums often enough.  I have a web service at http://minortriad.com/golem2hgt.html that generates .hgt files suitable for use with Jhex.  It works to the extent that LG returns hsgf--which has been broken for a while now, although only some games are affected.  See the bug report at https://bitbucket.org/rmalaschitz/littlegolem/issues/49/hsgf-generation-failure for an example.  I find it sad that LG management puts more effort into adding new games than in fixing even simple bugs with existing ones, but that's another story.

 Games for which LG doesn't return good hsgf also cannot be analyzed by trmph.  I have a workaround for that at http://minortriad.com/lg2trmph.html

 If you have a spec for syntax that can be read by HexGui, let me know and I can set up a web service for doing that translation.

#8 · wccanard

26 Apr 2016

Tom -- many thanks for these comments. I've been thinking a lot about general hex theory over the last few days and not really playing any games (all my games were either won, lost, just beginning or against players who hadn't moved for several days) so I never followed this up. But now I am playing a few more games and your comments have been really useful. I hadn't realised how powerful jhex was.

HexGui can read files that look like this:

(;AP[HexGui:0.9.GIT]FF[4]GM[11]SZ[19];AB[d1][d2][d3][d4][d5][d6][d7][d8]

[d9][d10][d11][d12][d13][d14][d15][d16]AW[o14][p14][q14][r14][e15][f15]

[g15][h15][i15][j15][k15][l15][m15][n15][r15][s15][c16][s16][b17][a18]

PL[W])

and also files that look like this:

(;FF[4]EV[hex.DEFAULT.mc.2016.apr.1.2]PB[Tom Ace]PW[wccanard]SZ[13]RE[B]GC[ game

 #1774188]SO[http://www.littlegolem.com];W[kb];B[gg];W[ji];B[jf];W[fg];B[ei];W[d

i];B[eh];W[dh];B[dj];W[bk];B[df];W[eg];B[cj];W[ch];B[bj];W[fh];B[gi];W[fi];B[ek]

;W[fj];B[fk];W[gj];B[hk];W[il];B[gl];W[ij];B[hj];W[ih];B[kj];W[ik];B[hg];W[hi];B

[gd];W[ge];B[hd];W[ee];B[ha];W[fc];B[fb];W[hb];B[ia];W[ib];B[resign])

However, when I read little golem files (like the above, a game you might recognise) into hexgui I get problems because of stupid things like the sides of the board being flipped (this is not a superficial colour issue -- this completely breaks things). I suspect it will just be a case of Richard using some slightly different conventions to HexGui (or perhaps changing things after HexGui was written). If I can ever be bothered to work out what exactly is going wrong I'll perhaps let people know here; I've managed to fix things up so far by occasionally editing the hsgf file; I was just wondering if someone else had already automated the process. Eventually I'll be interested in this again (when I lose games and want to find out why, rather than losing games and realising why, which is the state I'm currently in) and then I might come back to this issue. At the minute I'm more interested in templates and openings.

#9 · wccanard

28 Apr 2016

Tom I cannot get your http://minortriad.com/golem2hgt.html page to work with game 1774186 [warning: game still in progress so please no discussion]. This game is _not_ a victim of the current-time-in-milliseconds bug as far as I can see; whichever system I try to use (game number, trmph link etc) I get the error "missing (or invalid) board size spec in HSGF ". Sorry to bother you. Other games I've tried have worked extremely well -- many thanks for introducing me to Jhex. I won't tell you how much time I've sunk into analysing our game using it!

#10 · Carroll

28 Apr 2016

Here is the LG hsgf of this game, as displayed by https://www.littlegolem.net/jsp/game/png.jsp?gid=1774186

(;FF[4]EV[hex.DEFAULT.mc.2016.apr.1.2]PB[wccanard]PW[Shumacher;]]SZ[13]GC[ game #1774186]SO[http://www.littlegolem.com];W[ll];B[swap];W[gg];B[ij];W[fj];B[hc];W[dd];B[gf];W[dg];B[dh];W[eg];B[eh];W[fg];B[fi];W[ei];B[ej];W[hh];B[gi];W[cj];B[bi];W[dl];B[ek];W[hj];B[hk])
The size SZ[] parameter is here so I don't know what is wrong with it. Maybe Tom changed something on his part?

#11 · Tom Ace

30 Apr 2016

The right bracket character in the white player's name "Shumacher;]" was confusing my HSGF parsing code.  The bracket should be escaped with a backslash; I submitted a (low priority) bug report three months ago requesting that LG conform to the SGF spec.  See https://bitbucket.org/rmalaschitz/littlegolem/issues/47/brackets-in-usernames-need-to-be-escaped

 I changed my code today to tolerate this type of ill-formed HSGF, and it processes game 1774186 now.  Thanks to wccanard for reporting the problem.

#12 · wccanard

30 Apr 2016

Oh of course! I wouldn't expect Richard to be changing his hsgf any time soon. If it's any help, when I last played here in 2009 the site was equally chaotic if not more -- at the time it was possible to send malformed queries to the server which made your opponent play a move of your choice, for example. In more than one way! FatPhil sent three (I believe) critical bug reports to Richard with ways of exploiting the system but Richard did nothing, or at least did nothing at the time. If a malicious person had come along around then with the knowledge Phil had they could have caused chaos. In fact someone did discover one of them once, and I think that once it was actively being exploited Richard had to take the site offline and fix it, but when it came back Phil was still reporting that the other holes were there. No inputs were being sanitised at all; you could do all sorts of stuff. I don't even know if these ever got fixed but I do know that Phil spent a lot of time actively pleading with Richard, and nothing ever happened until there was one absolute disaster with people's ratings affected and passwords being changed etc (I remember having to create wccanard_temp just to post on the forum at some point because a hacker had changed my password (and several other people's -- it wasn't an error on my part). These were high-priority critical bugs with the site; the problem is that Richard has got a real jobs and real life, and this site is just a bit of fun, and it doesn't generate any income (you couldn't even be a member from 2002 to 2008) so he can't employ anyone to look after it full time (at least that was the situation in 2009). LG involves a lot of end-user workarounds. I came back to this site this year and there's a new tournament -- infinity tournament -- with not even any documentation on the main site (as far as I can see) about what it is and how it works. We just muddle on, to a certain extent because people like you write workarounds for stuff. Thanks again Tom!