Files @ 5b4c6f5a0a28
Branch filter:

Location: OneEye/src/tests/util.py - annotation

Laman
transposition table
import re

from go.core import Go
from statebag import BoardState


def simpleLoadSgf(filename):
	with open(filename) as f:
		contents=f.read()
	g=lambda m: tuple(ord(c)-ord('a') for c in reversed(m.group(1)))
	return [g(m) for m in re.finditer(r"\b[BW]\[([a-z]{2})\]",contents)]


def listStates(moves):
	g=Go()
	res=[BoardState(g.board)]
	for m in moves:
		g.doMove(g.toMove,*m)
		res.append(BoardState(g.board))
	return res