[computer-go] Pretty-printing game debugging output

Eric Boesch ericboesch at hotmail.com
Sun Oct 1 08:54:25 PDT 2006


It's not glamorous, but I finally got tired of sifting through hundreds of 
kilobytes of debugging output to figure out why my quasi-go-program was 
considering idiotic variations or screwing up its transposition table, so I 
wrote this:

http://mysite.verizon.net/eric.boesch1/code/hier2html.html

I'd be interested in others' ideas for handling this issue. What I've done 
probably isn't even the best quick and dirty solution, but I found it much 
better than nothing, and easier to write than a proper debugging GUI. I 
could have output XML instead, because I like the drill-down tree-output 
format that Mozilla (and IE I believe) use for vanilla XML, but I needed the 
ASCII diagrams to be shown preformatted, and I wasn't aware of an easy way 
to keep the drill-down tree view while retaining format control (with HTML 
or stylesheets), but one may well exist...

Since the HTML gets unwieldy above a certain size, I truncate its input. If 
the first 500,000 bytes doesn't show me what I want to know, then I open the 
plaintext backup (goview.out as created by the function below) in a text 
editor. Here's the bash function I happen to use for debugging:

goview () {
  Go "$@" 2>&1 | tee ~/goview.out | head --bytes=500000 | hier2html >| 
~/goview.html
}

I keep goview.html open in a browser and reload it after each run.




More information about the computer-go mailing list