If this is done one can study by degrees of difficulty.
Regards,
Justin
Kyu and dan levels on the sgf files
Re: Kyu and dan levels on the sgf files
Hi, are you talking about the offline version?
Re: Kyu and dan levels on the sgf files
Ok, I'll add the kyu and dan levels ... oh, it's already there!
The offline SGF files contain some extended tags:
The offline SGF files contain some extended tags:
- GE : genre
- DI : difficulty as kyu/dan value
- DP : difficulty as percentage
- SO : author (submitter)
- CO : old coolness value
Re: Kyu and dan levels on the sgf files
How do you suggest I allocate the right file, because they are individual files and the degrees of difficulty are pretty random.
Thanks
Thanks
Re: Kyu and dan levels on the sgf files
Hmm... So, you are using some software (such as CGoban) to open SGF files, and not using the offline site archive, right? And, to open a file of a certain level, you wish to know the level by its filename, right?
If you have Perl installed in your system, then this script will rename the files for you. The names will have kyu/dan levels, and be lexicographically sortable by the order of difficulty.
I don't think we can just change the naming rules on the site because that would cause troubles to other users who are using the files.
If you have Perl installed in your system, then this script will rename the files for you. The names will have kyu/dan levels, and be lexicographically sortable by the order of difficulty.
Code: Select all
use strict;
use integer;
chdir("goproblemsSGF"); # <-- modify this for your env.
foreach my $fn (<*.sgf>) {
my $f;
open($f,$fn);
my $t=<$f>;
close($f);
my $di=$t=~/DI\[(.*?)\]/?$1:'x';
my $dp=$t=~/DP\[(.*?)\]/?sprintf("%03d",$1):'x';
rename($fn,"$dp-$di-$fn");
}
Re: Kyu and dan levels on the sgf files
Thank you!
I can program, has been a whole I must say, but that will not be a problem.
Regards!
I can program, has been a whole I must say, but that will not be a problem.
Regards!
Re: Kyu and dan levels on the sgf files
Great idea tails!tails wrote: If you have Perl installed in your system, then this script will rename the files for you. (...)
I noticed that the script doesn't handle some SGF files which include line breaks before the tags. This is a bit of a problem, in the current goproblemsSGF collection there are nearly 400 files it won't handle. So I changed your script a bit. This one works on all files. Thanks and good luck everyone.
Code: Select all
# by tails on 2008-10-23
# v1.1 by usagi on 2010-08-01
use strict;
use integer;
foreach my $fn (<*.sgf>) {
my $f;
open my $FILE, '<' , $fn or die "can't open $fn $!";
my $di = 'x';
my $dp = 'x';
while (<$FILE>)
{
if ( /DI\[(.*?)\]/ )
{
$di = $1;
}
if ( /DP\[(.*?)\]/ )
{
$dp = sprintf("%03d",$1);
}
}
rename($fn,"$dp-$di-$fn");
}
Re: Kyu and dan levels on the sgf files
Thank you very much for the nice improvement, Usagi!