def goban_from_strings(strlist): size = max(len(strlist), reduce(lambda a, b: a+max(len(b)-a, 0), strlist, len(strlist))) ret = goban(size)
#print g.intersections[3, 3].group #test_data = open('../2010-03-07-Blanc-Noir.sgf').read() #test_data = open('../sgf/blob-gnugo.sgf').read() #test_data = open('../sgf/test.sgf').read() #test_data = open('../Murakawa-Iyama-9x9.sgf').read() #g=goban() #col = SGFParser(test_data).parse() #g.feed(col[0].mainline(), aftermove) #print #print unicode(g) #print estimate_score(g) #g=goban(9) #print lmscores(BLACK) g=goban('../sgf/goama134.sgf') st=shape_tree() st.from_strings(["sf", "fs"], 'crosscut') st.from_strings(["s.", "fs"], 'cutting_point') st.from_strings(["s!", "ss"], 'empty_triangle') st.from_strings(["ss", "!!", "ss"], 'bamboo_joint') stma = st.match_all(g) #print stma bad_shape = shape_tree() bad_shape.from_strings([".!.", "sfs", " f "], "tobi_tranche") bad_shape.from_strings(["...", "sf.", ".fs", "..."], "keima_tranche") bad_shape.from_strings(["s..", ".!.", "..s"], "elephant") bad_shape.from_strings(["s!", "Fs"], 'cutting_point') bad_shape.from_strings(["? ", "s! ", "ss?"], 'empty_triangle')