Merging sgf problem files?

If you're new to the game and have questions, post them here.
Aidoneus
Lives in gote
Posts: 603
Joined: Sat Mar 29, 2014 12:37 pm
GD Posts: 0
Location: Indiana
Has thanked: 114 times
Been thanked: 176 times

Merging sgf problem files?

Post by Aidoneus »

I have used "cmd copy *.sgf new.prb" but the resulting file always contains multiple errors. Among the worst: color switching (confusing with directions in the text), sometimes two problems in the same board, and answers always marked wrong. Can someone please explain a "nice" way to merge hundreds of single problem sgfs into one file. It would be especially nice if the merged file allows various options, such as keeping track of right/wrong counts, randomization of problems (even more useful if it preferentially loads missed problems), rotating board orientation, and switching color (with a switch in text). Thanks in advance for any help!
DrStraw
Oza
Posts: 2180
Joined: Tue Apr 27, 2010 4:09 am
Rank: AGA 5d
GD Posts: 4312
Online playing schedule: Every tenth February 29th from 20:00-20:01 (if time permits)
Location: ʍoquıɐɹ ǝɥʇ ɹǝʌo 'ǝɹǝɥʍǝɯos
Has thanked: 237 times
Been thanked: 662 times
Contact:

Re: Merging sgf problem files?

Post by DrStraw »

Years ago I wrote a routine which merged multiple sgf files into a single one. It was designed to work with a folder full of games but I guess it would work with problems. I think if would merge up to ten levels deep. I have not looked at it for 10 years. I wrote it in Excel VBA so it needs Excel to run. It could be converted to some other language if you know how. I could try to find it if you think I may help.
Still officially AGA 5d but I play so irregularly these days that I am probably only 3d or 4d over the board (but hopefully still 5d in terms of knowledge, theory and the ability to contribute).
Aidoneus
Lives in gote
Posts: 603
Joined: Sat Mar 29, 2014 12:37 pm
GD Posts: 0
Location: Indiana
Has thanked: 114 times
Been thanked: 176 times

Re: Merging sgf problem files?

Post by Aidoneus »

I have an older version of Excel, though I mostly use the OpenOffice suite. Assuming that I can run your program under one or the other of my programs, I would be interested in trying, and very grateful to you for your consideration whatever the result.
DrStraw
Oza
Posts: 2180
Joined: Tue Apr 27, 2010 4:09 am
Rank: AGA 5d
GD Posts: 4312
Online playing schedule: Every tenth February 29th from 20:00-20:01 (if time permits)
Location: ʍoquıɐɹ ǝɥʇ ɹǝʌo 'ǝɹǝɥʍǝɯos
Has thanked: 237 times
Been thanked: 662 times
Contact:

Re: Merging sgf problem files?

Post by DrStraw »

Send me a PM with an e-mail address and I'll mail it to you. I have to tell you though, that I have not looked at it for about 10 years (I found it and the file date was 2003) and make no claims with it. But if you can read VB you should be able to make sense of it.
Still officially AGA 5d but I play so irregularly these days that I am probably only 3d or 4d over the board (but hopefully still 5d in terms of knowledge, theory and the ability to contribute).
Aidoneus
Lives in gote
Posts: 603
Joined: Sat Mar 29, 2014 12:37 pm
GD Posts: 0
Location: Indiana
Has thanked: 114 times
Been thanked: 176 times

Re: Merging sgf problem files?

Post by Aidoneus »

OK, I sent you a PM (I think!). Thanks.
User avatar
leichtloeslich
Lives in gote
Posts: 314
Joined: Wed Feb 29, 2012 1:16 pm
Rank: KGS 4k
GD Posts: 0
Location: Germany
Has thanked: 10 times
Been thanked: 128 times

Re: Merging sgf problem files?

Post by leichtloeslich »

and answers always marked wrong.

It would be especially nice if the merged file allows various options, such as keeping track of right/wrong counts,

Don't get me wrong, but this sounds like you're confusing features of your specific sgf-editor (probably some sort of problem-solver thingy) with the sgf-format in general.
What sgf-editor are you using?

From what I read about sgf, just concatenating all sgf-files into a single file should work. I tried it with about 900 problem files I have, and it worked.
However, the only sgf-editor that correctly displayed the resulting collection-sgf was jago (gopanda had a buggy output, cgoban 3 simply ignored all but the first problem and gogui informed me that it simply doesn't support multiple sgf trees).


Either way, if certain sgf-editors have problems with game collections, maybe it's not a good idea to use them in the first place.
dfunkt
Dies with sente
Posts: 78
Joined: Sun Jan 01, 2012 1:17 pm
Rank: 9k
GD Posts: 0
Universal go server handle: dfunkt
Has thanked: 10 times
Been thanked: 33 times

Re: Merging sgf problem files?

Post by dfunkt »

Aidoneus
Lives in gote
Posts: 603
Joined: Sat Mar 29, 2014 12:37 pm
GD Posts: 0
Location: Indiana
Has thanked: 114 times
Been thanked: 176 times

Re: Merging sgf problem files?

Post by Aidoneus »

leichtloeslich: I downloaded Jago. It would only open the first problem from my merged file. Perhaps it is because of the way that I merged it. However, Many Faces of Go v12 does open the file, though with the issues I listed in my original post. BTW, David Fotland (author of MFG) suggested the cmd string to merge the files, though he said that he hadn't tried it. How did you concatenate the various problem files?

dfunkt: I found that program before asking here. Since there is no instruction at the site for using it in Windows, and I don't know anything about Java, I have no idea how to use it.

DrStraw: Thank you for your help, but I am afraid that if I have to learn Excel VBA to reprogram a macro, I will never get it to work for me. At least not without way too much hand holding. I apologize for wasting your time.

I have to say, though, that I am surprised that I haven't found any Go database program that can do what I ask. Does anyone know of a Go program that is comparable to ChessBase? ChessBase wasn't free, and I would pay for a good Go database program. I want to spend my free time learning Go, not learning to program!
User avatar
oca
Lives in gote
Posts: 699
Joined: Wed Feb 19, 2014 2:53 am
Rank: DDK
GD Posts: 0
KGS: aco
IGS: oca
OGS: oca
Location: Switzerland
Has thanked: 485 times
Been thanked: 166 times

Re: Merging sgf problem files?

Post by oca »

Aidoneus wrote:I have used "cmd copy *.sgf new.prb"


Did that command work better ?

Code: Select all

cmd copy /B *.sgf new.prb


If that don't work, I may look into the file to see if I can find something that may cause the problem.
but you will then need to send me the full sgf file so that I can look inside...
Converting the book Shape UP! by Charles Matthews/Seong-June Kim
to the gobook format. last updated april 2015 - Index of shapes, p.211 / 216
Aidoneus
Lives in gote
Posts: 603
Joined: Sat Mar 29, 2014 12:37 pm
GD Posts: 0
Location: Indiana
Has thanked: 114 times
Been thanked: 176 times

Re: Merging sgf problem files?

Post by Aidoneus »

oca: I tried your modified cmd string. Same trouble. I purchased GoGoD and membership at GoBase.org for problems, but I have also downloaded free problems from other sites, such as http://www.u-go.net/classic/. For example, after expanding qjzm.zip from the latter site, I had several hundred sgf problem files. Running either cmd copy variant produced one file, but with reversed colors. Although your cmd string seemed to reverse colors with just every other problem.

BTW, the problems included with MFG--Graded Go Problems for Beginners v 1--are located in just one file and work perfectly.
Aidoneus
Lives in gote
Posts: 603
Joined: Sat Mar 29, 2014 12:37 pm
GD Posts: 0
Location: Indiana
Has thanked: 114 times
Been thanked: 176 times

Re: Merging sgf problem files?

Post by Aidoneus »

oca: After looking at a few more problems in the merged file, it became clear that the file was broken--that is, I could not even input a solution or move forward through the stored solution, only step to the next problem, which again could not be solved.

Please let me know if the merged file works correctly with some other program than MFG.
User avatar
leichtloeslich
Lives in gote
Posts: 314
Joined: Wed Feb 29, 2012 1:16 pm
Rank: KGS 4k
GD Posts: 0
Location: Germany
Has thanked: 10 times
Been thanked: 128 times

Re: Merging sgf problem files?

Post by leichtloeslich »

I downloaded Jago. It would only open the first problem from my merged file.

Have you tried "Next game" in the "Nodes" menu?

How did you concatenate the various problem files?

Code: Select all

$ cat *.sgf > collection.sgf

That's how to concatenate files under linux. Under windows you do it via the "copy" command, as others have pointed out.


I have to say, though, that I am surprised that I haven't found any Go database program that can do what I ask. Does anyone know of a Go program that is comparable to ChessBase?

Not sure what Chessbase can do, but maybe check out Drago and GoGrinder.
User avatar
oca
Lives in gote
Posts: 699
Joined: Wed Feb 19, 2014 2:53 am
Rank: DDK
GD Posts: 0
KGS: aco
IGS: oca
OGS: oca
Location: Switzerland
Has thanked: 485 times
Been thanked: 166 times

Re: Merging sgf problem files?

Post by oca »

Aidoneus wrote: reversed colors

This is not a bug, this is a feature ;)

Many Faces of Go treats .prb files differently than .sgf files, with .prb file, there is a "problems" menu where there is an option "Random Orientation/Color".
Converting the book Shape UP! by Charles Matthews/Seong-June Kim
to the gobook format. last updated april 2015 - Index of shapes, p.211 / 216
Aidoneus
Lives in gote
Posts: 603
Joined: Sat Mar 29, 2014 12:37 pm
GD Posts: 0
Location: Indiana
Has thanked: 114 times
Been thanked: 176 times

Re: Merging sgf problem files?

Post by Aidoneus »

leichtloeslich: Yes, I would have tried next game except it was grayed out. And yes, I used the copy cmd to create a new prb file. I will take a look at GoGrinder, thank you.

oca: Yes, Random Orientation/Color is a nice feature in MFG, especially as it works with the included Graded Go Problems for Beginners v1. It does not work properly with any of my merged files.
First, each merged file will not open in MFG with Open/View/Edit Game or Solve Go Problems under File; they will open with Edit File of Go Problems under File. Second, for most problems the text directions (say, Black to move) and move side are reversed (White to move)--by itself a minor issue. Third, occasionally problems are run together on the board. Fourth, and this is the main issue, because the solutions are not reversed along with the colors, every problem answer will be marked wrong after the first correct move and no further moves can be made in a sequence--the full sequence will appear, however, but only by stepping through the stored solution.
If you still want to help, would you try merging the sgf files in qjzm.zip (a mere 17 kilobyte download) and see if you can get a single file that works properly--in MFG or any other program? And explain how I could replicate your result without having to learn a programming language? I can't afford to pull much more hair out! :lol:
Aidoneus
Lives in gote
Posts: 603
Joined: Sat Mar 29, 2014 12:37 pm
GD Posts: 0
Location: Indiana
Has thanked: 114 times
Been thanked: 176 times

Re: Merging sgf problem files?

Post by Aidoneus »

leichtloeslich: GoGrinder looks like it might be the go database program I have been looking for. At least if I can figure out why it will load the default single sgf files in one folder, but not (yet!) a folder with my single sgf files. If I could get this to work, I wouldn't need to merge the sgf files. I suppose that I need to read the documentation before asking any more questions...
Post Reply