gnugo-devel
[Top][All Lists]
Advanced

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

Re: [gnugo-devel] Regression tests corrections


From: Gunnar Farneback
Subject: Re: [gnugo-devel] Regression tests corrections
Date: Fri, 09 Nov 2001 18:26:21 +0100
User-agent: EMH/1.14.1 SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.3 Emacs/20.7 (sparc-sun-solaris2.7) (with unibyte mode)

Arend wrote:
> Hmm, I failed some tests :-) No, seriously, what to do with tests where I
> agree with GnuGo instead of the proposed solution? Mail a list of comments
> here? Send a patch with comments to the .tst-files added? Or just a patch
> that corrects them? (Reluctant to do that before someone else agrees.)

All of the above. :-) Either way is fine and the easier it is for us
to evaluate and apply your changes, the better.

> Also, I collected a series of blunders of GnuGo 3.0.0 in a .tst file. Are
> you interested in adding these tests?

Most likely.

> If so, do you know a script that deletes the comments etc. from the
> sgf-files gnugo -o produces?

I have one written in Pike which I include below. Running it requires
a Pike interpreter, which can be downloaded from
http://pike.roxen.com.

> Btw, some good news for you, GnuGo 3.1.13 produced an unexpected pass on
> one third of the problems, seems you did some useful work in the last three
> months! :)

Indeed there are some common themes among the bad mistakes.

/Gunnar

#!/usr/local/bin/pike

int header = 1;
int move_count = 0;

string process_line(string line)
{
  string s = "";
  if (header && (search(line, ";W") >= 0 || search(line, ";B") >= 0))
    header = 0;
  
  if (header && line != "")
    s += line + "\n";
  else
  {
    string move;
    if (sizeof(line/";") > 1)
        line = ";" + ((line/";")[1..])*";";
    if (sscanf(line, ";B[%2s]", move) > 0)
    {
        s += ";B[" + move + "]";
        move_count++;
    }
    if (sscanf(line, ";W[%2s]", move) > 0)
    {
        s += ";W[" + move + "]";
        move_count++;
    }
    if (move_count == 10)
    {
        move_count = 0;
        s += "\n";
    }
    if (line[0..0] == ")") 
    {
        if (move_count > 0)
          s += "\n";
        s += ")\n";
    }
  }
  return s;
}

int main(int argc, array(string) argv)
{
  string s = "";
  if (argc < 2)
  {
    while (string line = Stdio.stdin.gets())
    {
      s += process_line(line);
    }
  }
  else
  {
    string sgf = Stdio.read_bytes(argv[1]);
    foreach (sgf/"\n", string line)
    {
      s += process_line(line);
    }
  }

  if (argc < 3)
    write(s);
  else
    Stdio.write_file(argv[2], s);
}



reply via email to

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