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

Re: [computer-go] test data for benson's algorithm



At 08:45 AM 9/3/03 -0700, you wrote:
For what it's worth, you can look at the Java code in our BensonLife class. The .jar file of all our code is available at:

http://www.lclark.edu/~drake/go/
i got your code to eat some of my test files. your version seems to have a problem with the case where a group with two fake eyes can live (or maybe i am wrong). anyway, he seems to be confused with the encircled groups in the center of the board at http://tayek.com/~ray/go/oregoBenson/benson1.txt. i used the code below to write this file. maybe i am doing somethng wrong? (i have an edge around my board so it's n+2 x n+2).

does anyone have any sample test data for benson?

thanks

import java.io.*;
public class Orego {
static orego.lclark.Board toOregoBoard(final benson.Board board) {
orego.lclark.Board oregoBoard=new orego.lclark.Board();
final int n=board.boardSize();
for(int i=1;i<=n;i++)
for(int j=1;j<=n;j++)
if(board.stone(i,j)==Stone.white)
oregoBoard=oregoBoard.play((n-i)*n+j-1,orego.lclark.Board.WHITE);
else if(board.stone(i,j)==Stone.black)
oregoBoard=oregoBoard.play((n-i)*n+j-1,orego.lclark.Board.BLACK);
return oregoBoard;
}
public static void test(){
System.out.println("--------------------------------------- orego's test");
BensonLife detector = new BensonLife();
MinimaxPlayer player = new MinimaxPlayer();
player.setBoardSize(5);
orego.lclark.Board board = new orego.lclark.Board();
if(false) board = board.play(0, orego.lclark.Board.WHITE);
board = board.play(1, orego.lclark.Board.WHITE);
board = board.play(4, orego.lclark.Board.WHITE);
board = board.play(5, orego.lclark.Board.WHITE);
board = board.play(6, orego.lclark.Board.WHITE);
board = board.play(7, orego.lclark.Board.WHITE);
board = board.play(8, orego.lclark.Board.WHITE);
if(true) board = board.play(9, orego.lclark.Board.WHITE);
System.out.println(board);
System.out.println(detector.evaluate(board,orego.lclark.Board.WHITE));
System.out.println(detector.alive());
System.out.println(detector.dead());
}
public static void test(final File file) {
Vector boards=benson.Board.readBoards(file.getAbsolutePath());
System.out.println("read "+boards.size()+" boards from "+file);
for(int k=0;k<boards.size();k++) {
benson.Board board=(benson.Board)boards.elementAt(k);
System.out.println("--------------------------------------- ray's benson");
System.out.println(board.niceToString());
if(true) {
Benson benson=new Benson(board);
if(false) {
for(int i=0;i<benson.blocks().xBlock().length;i++)
System.out.println(benson.blocks().xBlock()[i]);
for(int i=0;i<benson.regions().smallXEnclosed().length;i++)
System.out.println(benson.regions().smallXEnclosed()[i]);
for(int i=0;i<benson.groups().size();i++)
benson.testGroup((Group)benson.groups().elementAt(i));
}
}
if(board.boardSize()>=3) {
System.out.println("--------------------------------------- orego's benson");
BensonLife detector=new BensonLife();
MinimaxPlayer player=new MinimaxPlayer();
player.setBoardSize(board.boardSize());
orego.lclark.Board oregoBoard=null;
oregoBoard=toOregoBoard(board);
System.out.println(oregoBoard);
System.out.println(detector.evaluate(oregoBoard,orego.lclark.Board.WHITE));
System.out.println("--------------------------------------- alive white");
System.out.println(detector.alive());
System.out.println("--------------------------------------- dead white");
System.out.println(detector.dead());
System.out.println(detector.evaluate(oregoBoard,orego.lclark.Board.BLACK));
System.out.println("--------------------------------------- alive black");
System.out.println(detector.alive());
System.out.println("--------------------------------------- dead black");
System.out.println(detector.dead());
} else {
System.out.println("board size of "+board.boardSize()+" is too small for orego");
}
System.out.println("---------------------------------------");
}
}
public static void main(String[] args) {
if(true) { test(); if(false) return; }
test(new File("h:/go/benson/test.txt"));
test(new File("h:/go/benson/test0.txt"));
}
}



On Tuesday, September 2, 2003, at 04:35  PM, Ray Tayek wrote:

hi, starting to fool around with some old java code i wrote to do benson's algorithm. while i have some test cases, i was wondering if anyone has a pointer to more test data....
---
ray tayek http://tayek.com/ actively seeking mentoring or telecommuting work
vice chair orange county java users group http://www.ocjug.org/
hate spam? http://samspade.org/ssw/
_______________________________________________
computer-go mailing list
computer-go@xxxxxxxxxxxxxxxxx
http://computer-go.org/mailman/listinfo/computer-go