import os, numpy as npprint(NAMES)print(SHAPES)print(os.listdir('/work'))['L1.W', 'L1.b', 'L2.W', 'L2.b', 'L3.W', 'L3.b', 'L4.W', 'L4.b', 'L5.W', 'L5.b', 'L6.W', 'L6.b', 'out.W', 'out.b']{'L1.W': (243, 512), 'L1.b': (512,), 'L2.W': (512, 512), 'L2.b': (512,), 'L3.W': (512, 512), 'L3.b': (512,), 'L4.W': (512, 512), 'L4.b': (512,), 'L5.W': (512, 512), 'L5.b': (512,), 'L6.W': (512, 512), 'L6.b': (512,), 'out.W': (512, 82), 'out.b': (82,)}['arch.json', 'net']import os, textwrapsource = r'''import numpy as npfrom pathlib import Path
def build_policy(cfg=None): p = dict(capture=11., capture_extra=3., save=7., danger=10., eye=22., isolation=3., isolation_threshold=2.5, base=1.3, pass_bias=-1., attack=1.3, own_adj=.65, opp_adj=.3, opening=2.0, save_danger=2., safe2=1., safe3=1., cap_safety=1.) if cfg: p.update(cfg) shapes = {'L1.W':(243,512), 'out.W':(512,82), 'out.b':(82,)} for k in range(1,7): shapes[f'L{k}.b']=(512,) if k>1: shapes[f'L{k}.W']=(512,512) a = {n:np.zeros(s,np.float32) for n,s in shapes.items()} def u(ch,q): return ch*81+q xy=[divmod(q,9) for q in range(81)] adj=[] for r,c in xy: adj.append([rr*9+cc for rr,cc in [(r-1,c),(r+1,c),(r,c-1),(r,c+1)] if 0<=rr<9 and 0<=cc<9]) def w(k,i,j,v): a[f'L{k}.W'][i,j]+=v def b(k,j,v): a[f'L{k}.b'][j]+=v def cp(k,ch): for q in range(81): w(k,u(ch,q),u(ch,q),1.) for q in range(81): w(1,3*q,u(0,q),1) w(1,3*q+1,u(1,q),1) for color, ch in [(0,2),(1,4)]: for off in [0,1]: j=u(ch+off,q) b(1,j,len(adj[q])-4-off) w(1,3*q+color,j,4) for t in adj[q]: w(1,3*t,j,-1) w(1,3*t+1,j,-1) # Global, phase-dependent positional prior; no clock or history is assumed. b(1,486,1.) for q in range(81): w(1,3*q,486,-1/30) w(1,3*q+1,486,-1/30) w(1,2,487,1) for k in range(2,5): cp(k,0); cp(k,1) w(k,486,486,1); w(k,487,487,1)
# Safe-group seeds: two liberties on one stone, or liberties on # two adjacent stones (which cannot be the same empty intersection). for q in range(81): for color,ch in [(0,2),(1,4)]: ja,jb=u(ch,q),u(ch+1,q) w(2,u(color,q),ja,1) for t in [q]+adj[q]: w(2,u(ch+1,t),ja,-1) b(2,jb,-4) w(2,u(ch,q),jb,4) w(2,u(ch+1,q),jb,-4) for t in adj[q]: w(2,u(ch,t),jb,1) w(2,u(ch+1,t),jb,-1)
for q in range(81): for color,prev,new,seed in [(0,2,2,4),(1,4,3,5)]: j=u(new,q) w(3,u(prev,q),j,1) w(3,u(prev+1,q),j,-1) for t in adj[q]: w(3,u(color,t),j,-1) w(3,u(prev,t),j,1) w(3,u(prev+1,t),j,-1) j=u(seed,q) b(3,j,len(adj[q])-6) w(3,u(color,q),j,4) for t in adj[q]: w(3,u(0,t),j,-1); w(3,u(1,t),j,-1) for q in range(81): for color,unsafe,seed in [(0,2,4),(1,3,5)]: j=u(unsafe,q) w(4,u(unsafe,q),j,1) for t in adj[q]: w(4,u(color,t),j,-1) w(4,u(unsafe,t),j,1) j=u(seed,q) w(4,u(color,q),j,1) for t in [q]+adj[q]: w(4,u(seed,t),j,-1)
line=[-1.2,0.,.6,.8,.9,.8,.6,0.,-1.2] for q,(r,c) in enumerate(xy): C,S,D,E,I,P=[u(ch,q) for ch in range(6)] b(5,D,2-len(adj[q])) b(5,E,1-len(adj[q])) b(5,I,-p['isolation_threshold']) b(5,P,40+p['base']+line[r]+line[c]) central=max(0.,1.-((r-4)**2+(c-4)**2)/24) w(5,486,P,p['opening']*central) for t in adj[q]: w(5,u(3,t),C,1) w(5,u(2,t),S,1) w(5,u(0,t),D,1-p['safe2']-p['safe3']) w(5,u(1,t),D,1) w(5,u(2,t),D,p['safe2']) w(5,u(4,t),D,p['safe3']) w(5,u(3,t),D,-p['cap_safety']) w(5,u(0,t),E,1) w(5,u(5,t),P,p['attack']) w(5,u(3,t),P,-p['attack']) for t,(rr,cc) in enumerate(xy): dr,dc=abs(rr-r),abs(cc-c) d=dr+dc if d==1: wm,wo=p['own_adj'],p['opp_adj'] elif d==2: wm,wo=(-.10,.15) if dr==dc==1 else (.15,.35) elif d==3: wm,wo=-.12,.10 elif d==4: wm,wo=-.08,0. else: wm=wo=0. if wm: w(5,u(0,t),P,wm) if wo: w(5,u(1,t),P,wo) iw={1:1.,2:.6,3:.25}.get(d,0.) if iw: w(5,u(1,t),I,iw) w(5,u(0,t),I,-1.25*iw) w(6,C,u(0,q),1) w(6,C,u(1,q),1); b(6,u(1,q),-1) w(6,S,u(2,q),1); w(6,D,u(2,q),-p['save_danger']) w(6,D,u(3,q),1) w(6,E,u(4,q),p['eye']) w(6,I,u(4,q),p['isolation']) w(6,P,u(5,q),1) for ch,v in enumerate([p['capture'],p['capture_extra']-p['capture'], p['save'],-p['danger'],-1.,1.]): a['out.W'][u(ch,q),q]=v a['out.b'][q]=-40. a['out.b'][81]=p['pass_bias'] return a,p
def install(cfg=None): a,p=build_policy(cfg) for n,v in a.items(): save(n,v) return p'''open('/work/design.py','w').write(source)exec(source)config=install()import jsonjson.dump(config,open('/work/config_v1.json','w'),indent=2)print(config)print('Saved',len(saved()),'tensors. Nonzero weights:',sum(np.count_nonzero(load(n)) for n in NAMES)){'capture': 11.0, 'capture_extra': 3.0, 'save': 7.0, 'danger': 10.0, 'eye': 22.0, 'isolation': 3.0, 'isolation_threshold': 2.5, 'base': 1.3, 'pass_bias': -1.0, 'attack': 1.3, 'own_adj': 0.65, 'opp_adj': 0.3, 'opening': 2.0, 'save_danger': 2.0, 'safe2': 1.0, 'safe3': 1.0, 'cap_safety': 1.0}Saved 14 tensors. Nonzero weights: 23118{"games":{"strong":64,"weak":32,"random":32}}{"ok": true, "pass": 1, "kind": "games", "per_opponent": {"random": {"games": 32, "score": 0.96875, "wins": 31, "losses": 1, "score_as_black": 0.9375, "score_as_white": 1.0, "mean_margin": 75.8125, "mean_length": 120.40625, "stones_captured_per_game": 85.5625, "stones_lost_per_game": 0.78125, "passes_per_game": 1.21875, "games_with_a_pass_before_move_60": 0, "end_two_passes": 32, "end_repetition": 0, "end_move_limit": 0}, "strong": {"games": 64, "score": 0.46875, "wins": 30, "losses": 34, "score_as_black": 0.375, "score_as_white": 0.5625, "mean_margin": 25.765625, "mean_length": 110.3125, "stones_captured_per_game": 49.703125, "stones_lost_per_game": 14.328125, "passes_per_game": 2.890625, "games_with_a_pass_before_move_60": 0, "end_two_passes": 59, "end_repetition": 3, "end_move_limit": 2}, "weak": {"games": 32, "score": 0.78125, "wins": 25, "losses": 7, "score_as_black": 0.75, "score_as_white": 0.8125, "mean_margin": 59.6875, "mean_length": 121.21875, "stones_captured_per_game": 71.0, "stones_lost_per_game": 6.125, "passes_per_game": 2.71875, "games_with_a_pass_before_move_60": 0, "end_two_passes": 30, "end_repetition": 1, "end_move_limit": 1}}, "files": "/work/pass_1/", "readme": "games.json: one entry per game (opponent, net_color, result +1/-1, margin = net's area score minus the opponent's incl. komi, end, stones captured / lost, moves: ply, by, move (row*9+col, 81 = pass), and for the network's moves its top-5 [move, probability]). boards.npy: (games, 162, 81) int8, the board AFTER each ply (1 Black, -1 White, 0 empty; index row*9+col); valid.npy: (games, 162) which plies were played."}import json, numpy as npg=json.load(open('/work/pass_1/games.json'))print(type(g))print(str(g[0])[:2500])for i,x in enumerate(g): if x['opponent']=='strong': print(i,{k:v for k,v in x.items() if k!='moves'})<class 'list'>{'game': 0, 'opponent': 'random', 'net_color': 'black', 'result': 1, 'margin': 73.5, 'end': 'two passes', 'stones_captured_by_net': 104, 'stones_lost_by_net': 0, 'moves': [{'ply': 0, 'by': 'net', 'move': 49, 'top5': [[40, 0.0573], [31, 0.0477], [39, 0.0477], [41, 0.0477], [49, 0.0477]]}, {'ply': 1, 'by': 'opponent', 'move': 65}, {'ply': 2, 'by': 'net', 'move': 57, 'top5': [[40, 0.096], [48, 0.0743], [50, 0.0672], [58, 0.0576], [31, 0.0487]]}, {'ply': 3, 'by': 'opponent', 'move': 3}, {'ply': 4, 'by': 'net', 'move': 24, 'top5': [[48, 0.1266], [58, 0.0992], [40, 0.0749], [50, 0.053], [31, 0.0398]]}, {'ply': 5, 'by': 'opponent', 'move': 59}, {'ply': 6, 'by': 'net', 'move': 29, 'top5': [[48, 0.1262], [58, 0.1221], [40, 0.0681], [50, 0.0596], [39, 0.035]]}, {'ply': 7, 'by': 'opponent', 'move': 63}, {'ply': 8, 'by': 'net', 'move': 33, 'top5': [[58, 0.1201], [48, 0.1089], [40, 0.0581], [50, 0.058], [30, 0.0421]]}, {'ply': 9, 'by': 'opponent', 'move': 4}, {'ply': 10, 'by': 'net', 'move': 41, 'top5': [[58, 0.1105], [48, 0.0991], [50, 0.0468], [40, 0.0464], [42, 0.044]]}, {'ply': 11, 'by': 'opponent', 'move': 72}, {'ply': 12, 'by': 'net', 'move': 48, 'top5': [[58, 0.0877], [50, 0.0793], [48, 0.0778], [40, 0.0778], [42, 0.0755]]}, {'ply': 13, 'by': 'opponent', 'move': 0}, {'ply': 14, 'by': 'net', 'move': 50, 'top5': [[50, 0.0953], [58, 0.0829], [42, 0.0728], [40, 0.0719], [32, 0.0608]]}, {'ply': 15, 'by': 'opponent', 'move': 17}, {'ply': 16, 'by': 'net', 'move': 13, 'top5': [[58, 0.0836], [32, 0.0778], [42, 0.0734], [40, 0.0709], [39, 0.05]]}, {'ply': 17, 'by': 'opponent', 'move': 67}, {'ply': 18, 'by': 'net', 'move': 32, 'top5': [[58, 0.1069], [42, 0.0695], [12, 0.0675], [32, 0.0646], [40, 0.0644]]}, {'ply': 19, 'by': 'opponent', 'move': 34}, {'ply': 20, 'by': 'net', 'move': 40, 'top5': [[58, 0.1002], [42, 0.0742], [31, 0.0667], [12, 0.0654], [40, 0.0579]]}, {'ply': 21, 'by': 'opponent', 'move': 44}, {'ply': 22, 'by': 'net', 'move': 47, 'top5': [[31, 0.1146], [42, 0.1116], [58, 0.1062], [39, 0.0655], [12, 0.0569]]}, {'ply': 23, 'by': 'opponent', 'move': 10}, {'ply': 24, 'by': 'net', 'move': 79, 'top5': [[42, 0.1099], [31, 0.1025], [58, 0.0927], [12, 0.0822], [39, 0.0574]]}, {'ply': 25, 'by': 'opponent', 'move': 16}, {'ply': 26, 'by': 'net', 'move': 22, 'top5': [[42, 0.1055], [31, 0.0967], [58, 0.089], [12, 0.0816], [39, 0.0542]]}, {'ply': 27, 'by': 'opponent', 'move': 18}, {'ply': 28, 'by': 'net', 'move': 15, 'top5': [[31, 0.1661], [42, 0.0887], [23, 0.0865], [58, 0.32 {'game': 32, 'opponent': 'strong', 'net_color': 'black', 'result': -1, 'margin': -11.5, 'end': 'two passes', 'stones_captured_by_net': 4, 'stones_lost_by_net': 16}33 {'game': 33, 'opponent': 'strong', 'net_color': 'black', 'result': -1, 'margin': -4.5, 'end': 'two passes', 'stones_captured_by_net': 6, 'stones_lost_by_net': 6}34 {'game': 34, 'opponent': 'strong', 'net_color': 'black', 'result': -1, 'margin': -10.5, 'end': 'two passes', 'stones_captured_by_net': 26, 'stones_lost_by_net': 23}35 {'game': 35, 'opponent': 'strong', 'net_color': 'black', 'result': 1, 'margin': 73.5, 'end': 'two passes', 'stones_captured_by_net': 108, 'stones_lost_by_net': 9}36 {'game': 36, 'opponent': 'strong', 'net_color': 'black', 'result': 1, 'margin': 73.5, 'end': 'two passes', 'stones_captured_by_net': 106, 'stones_lost_by_net': 4}37 {'game': 37, 'opponent': 'strong', 'net_color': 'black', 'result': 1, 'margin': 13.5, 'end': 'two passes', 'stones_captured_by_net': 29, 'stones_lost_by_net': 4}38 {'game': 38, 'opponent': 'strong', 'net_color': 'black', 'result': 1, 'margin': 7.5, 'end': 'two passes', 'stones_captured_by_net': 22, 'stones_lost_by_net': 5}39 {'game': 39, 'opponent': 'strong', 'net_color': 'black', 'result': -1, 'margin': -23.5, 'end': 'two passes', 'stones_captured_by_net': 2, 'stones_lost_by_net': 13}40 {'game': 40, 'opponent': 'strong', 'net_color': 'black', 'result': 1, 'margin': 73.5, 'end': 'two passes', 'stones_captured_by_net': 148, 'stones_lost_by_net': 5}41 {'game': 41, 'opponent': 'strong', 'net_color': 'black', 'result': -1, 'margin': -19.5, 'end': 'two passes', 'stones_captured_by_net': 8, 'stones_lost_by_net': 17}42 {'game': 42, 'opponent': 'strong', 'net_color': 'black', 'result': -1, 'margin': 11.5, 'end': 'repetition', 'stones_captured_by_net': 20, 'stones_lost_by_net': 8}43 {'game': 43, 'opponent': 'strong', 'net_color': 'black', 'result': -1, 'margin': -24.5, 'end': 'two passes', 'stones_captured_by_net': 7, 'stones_lost_by_net': 22}44 {'game': 44, 'opponent': 'strong', 'net_color': 'black', 'result': -1, 'margin': -12.5, 'end': 'two passes', 'stones_captured_by_net': 11, 'stones_lost_by_net': 20}45 {'game': 45, 'opponent': 'strong', 'net_color': 'black', 'result': -1, 'margin': -12.5, 'end': 'repetition', 'stones_captured_by_net': 17, 'stones_lost_by_net': 41}46 {'game': 46, 'opponent': 'strong', 'net_color': 'black', 'result': -1, 'margin': -8.5, 'end': 'two passes', 'stones_captured_by_net': 15, 'stones_lost_by_net': 15}47 {'game': 47, 'opponent': 'strong', 'net_color': 'black', 'result': -1, 'margin': -11.5, 'end': 'two passes', 'stones_captured_by_net': 6, 'stones_lost_by_net': 7}48 {'game': 48, 'opponent': 'strong', 'net_color': 'black', 'result': -1, 'margin': -2.5, 'end': 'repetition', 'stones_captured_by_net': 4, 'stones_lost_by_net': 2}49 {'game': 49, 'opponent': 'strong', 'net_color': 'black', 'result': 1, 'margin': 1.5, 'end': 'two passes', 'stones_captured_by_net': 13, 'stones_lost_by_net': 6}50 {'game': 50, 'opponent': 'strong', 'net_color': 'black', 'result': 1, 'margin': 73.5, 'end': 'two passes', 'stones_captured_by_net': 79, 'stones_lost_by_net': 0}51 {'game': 51, 'opponent': 'strong', 'net_color': 'black', 'result': 1, 'margin': 73.5, 'end': 'two passes', 'stones_captured_by_net': 156, 'stones_lost_by_net': 10}52 {'game': 52, 'opponent': 'strong', 'net_color': 'black', 'result': -1, 'margin': -12.5, 'end': 'two passes', 'stones_captured_by_net': 6, 'stones_lost_by_net': 7}53 {'game': 53, 'opponent': 'strong', 'net_color': 'black', 'result': -1, 'margin': -12.5, 'end': 'two passes', 'stones_captured_by_net': 3, 'stones_lost_by_net': 5}54 {'game': 54, 'opponent': 'strong', 'net_color': 'black', 'result': -1, 'margin': -10.5, 'end': 'two passes', 'stones_captured_by_net': 8, 'stones_lost_by_net': 17}55 {'game': 55, 'opponent': 'strong', 'net_color': 'black', 'result': 1, 'margin': 73.5, 'end': 'two passes', 'stones_captured_by_net': 116, 'stones_lost_by_net': 5}56 {'game': 56, 'opponent': 'strong', 'net_color': 'black', 'result': 1, 'margin': 73.5, 'end': 'two passes', 'stones_captured_by_net': 100, 'stones_lost_by_net': 0}57 {'game': 57, 'opponent': 'strong', 'net_color': 'black', 'result': -1, 'margin': -22.5, 'end': 'two passes', 'stones_captured_by_net': 6, 'stones_lost_by_net': 21}58 {'game': 58, 'opponent': 'strong', 'net_color': 'black', 'result': -1, 'margin': -6.5, 'end': 'two passes', 'stones_captured_by_net': 19, 'stones_lost_by_net': 35}59 {'game': 59, 'opponent': 'strong', 'net_color': 'black', 'result': -1, 'margin': -8.5, 'end': 'two passes', 'stones_captured_by_net': 6, 'stones_lost_by_net': 11}60 {'game': 60, 'opponent': 'strong', 'net_color': 'black', 'result': -1, 'margin': -3.5, 'end': 'two passes', 'stones_captured_by_net': 10, 'stones_lost_by_net': 7}61 {'game': 61, 'opponent': 'strong', 'net_color': 'black', 'result': 1, 'margin': 73.5, 'end': 'two passes', 'stones_captured_by_net': 77, 'stones_lost_by_net': 1}62 {'game': 62, 'opponent': 'strong', 'net_color': 'black', 'result': 1, 'margin': 73.5, 'end': 'two passes', 'stones_captured_by_net': 101, 'stones_lost_by_net': 0}63 {'game': 63, 'opponent': 'strong', 'net_color': 'black', 'result': -1, 'margin': -2.5, 'end': 'two passes', 'stones_captured_by_net': 20, 'stones_lost_by_net': 15}64 {'game': 64, 'opponent': 'strong', 'net_color': 'white', 'result': 1, 'margin': 2.5, 'end': 'two passes', 'stones_captured_by_net': 14, 'stones_lost_by_net': 22}65 {'game': 65, 'opponent': 'strong', 'net_color': 'white', 'result': 1, 'margin': 88.5, 'end': 'two passes', 'stones_captured_by_net': 123, 'stones_lost_by_net': 5}66 {'game': 66, 'opponent': 'strong', 'net_color': 'white', 'result': -1, 'margin': -2.5, 'end': 'two passes', 'stones_captured_by_net': 12, 'stones_lost_by_net': 22}67 {'game': 67, 'opponent': 'strong', 'net_color': 'white', 'result': -1, 'margin': -6.5, 'end': 'two passes', 'stones_captured_by_net': 8, 'stones_lost_by_net': 22}68 {'game': 68, 'opponent': 'strong', 'net_color': 'white', 'result': -1, 'margin': -19.5, 'end': 'two passes', 'stones_captured_by_net': 5, 'stones_lost_by_net': 16}69 {'game': 69, 'opponent': 'strong', 'net_color': 'white', 'result': -1, 'margin': -19.5, 'end': 'two passes', 'stones_captured_by_net': 3, 'stones_lost_by_net': 32}70 {'game': 70, 'opponent': 'strong', 'net_color': 'white', 'result': 1, 'margin': 88.5, 'end': 'two passes', 'stones_captured_by_net': 82, 'stones_lost_by_net': 2}71 {'game': 71, 'opponent': 'strong', 'net_color': 'white', 'result': 1, 'margin': 88.5, 'end': 'two passes', 'stones_captured_by_net': 114, 'stones_lost_by_net': 3}72 {'game': 72, 'opponent': 'strong', 'net_color': 'white', 'result': 1, 'margin': 88.5, 'end': 'two passes', 'stones_captured_by_net': 83, 'stones_lost_by_net': 1}73 {'game': 73, 'opponent': 'strong', 'net_color': 'white', 'result': -1, 'margin': -1.5, 'end': 'two passes', 'stones_captured_by_net': 6, 'stones_lost_by_net': 13}74 {'game': 74, 'opponent': 'strong', 'net_color': 'white', 'result': 1, 'margin': 88.5, 'end': 'two passes', 'stones_captured_by_net': 176, 'stones_lost_by_net': 7}75 {'game': 75, 'opponent': 'strong', 'net_color': 'white', 'result': -1, 'margin': -8.5, 'end': 'two passes', 'stones_captured_by_net': 6, 'stones_lost_by_net': 17}76 {'game': 76, 'opponent': 'strong', 'net_color': 'white', 'result': 1, 'margin': 88.5, 'end': 'two passes', 'stones_captured_by_net': 175, 'stones_lost_by_net': 16}77 {'game': 77, 'opponent': 'strong', 'net_color': 'white', 'result': -1, 'margin': -18.5, 'end': 'two passes', 'stones_captured_by_net': 4, 'stones_lost_by_net': 29}78 {'game': 78, 'opponent': 'strong', 'net_color': 'white', 'result': -1, 'margin': -19.5, 'end': 'two passes', 'stones_captured_by_net': 5, 'stones_lost_by_net': 19}79 {'game': 79, 'opponent': 'strong', 'net_color': 'white', 'result': 1, 'margin': 88.5, 'end': 'two passes', 'stones_captured_by_net': 86, 'stones_lost_by_net': 2}80 {'game': 80, 'opponent': 'strong', 'net_color': 'white', 'result': -1, 'margin': -8.5, 'end': 'two passes', 'stones_captured_by_net': 11, 'stones_lost_by_net': 35}81 {'game': 81, 'opponent': 'strong', 'net_color': 'white', 'result': 1, 'margin': 88.5, 'end': 'two passes', 'stones_captured_by_net': 96, 'stones_lost_by_net': 3}82 {'game': 82, 'opponent': 'strong', 'net_color': 'white', 'result': 1, 'margin': 88.5, 'end': 'two passes', 'stones_captured_by_net': 84, 'stones_lost_by_net': 2}83 {'game': 83, 'opponent': 'strong', 'net_color': 'white', 'result': 1, 'margin': 88.5, 'end': 'two passes', 'stones_captured_by_net': 132, 'stones_lost_by_net': 4}84 {'game': 84, 'opponent': 'strong', 'net_color': 'white', 'result': 1, 'margin': 88.5, 'end': 'two passes', 'stones_captured_by_net': 93, 'stones_lost_by_net': 6}85 {'game': 85, 'opponent': 'strong', 'net_color': 'white', 'result': 1, 'margin': 88.5, 'end': 'two passes', 'stones_captured_by_net': 95, 'stones_lost_by_net': 1}86 {'game': 86, 'opponent': 'strong', 'net_color': 'white', 'result': 1, 'margin': 88.5, 'end': 'two passes', 'stones_captured_by_net': 78, 'stones_lost_by_net': 1}87 {'game': 87, 'opponent': 'strong', 'net_color': 'white', 'result': -1, 'margin': -25.5, 'end': 'two passes', 'stones_captured_by_net': 2, 'stones_lost_by_net': 24}88 {'game': 88, 'opponent': 'strong', 'net_color': 'white', 'result': -1, 'margin': -0.5, 'end': 'two passes', 'stones_captured_by_net': 13, 'stones_lost_by_net': 20}89 {'game': 89, 'opponent': 'strong', 'net_color': 'white', 'result': 1, 'margin': 1.5, 'end': 'two passes', 'stones_captured_by_net': 20, 'stones_lost_by_net': 19}90 {'game': 90, 'opponent': 'strong', 'net_color': 'white', 'result': 1, 'margin': 88.5, 'end': 'move limit', 'stones_captured_by_net': 199, 'stones_lost_by_net': 18}91 {'game': 91, 'opponent': 'strong', 'net_color': 'white', 'result': -1, 'margin': -20.5, 'end': 'two passes', 'stones_captured_by_net': 1, 'stones_lost_by_net': 19}92 {'game': 92, 'opponent': 'strong', 'net_color': 'white', 'result': 1, 'margin': 6.5, 'end': 'two passes', 'stones_captured_by_net': 26, 'stones_lost_by_net': 43}93 {'game': 93, 'opponent': 'strong', 'net_color': 'white', 'result': -1, 'margin': -9.5, 'end': 'two passes', 'stones_captured_by_net': 14, 'stones_lost_by_net': 59}94 {'game': 94, 'opponent': 'strong', 'net_color': 'white', 'result': -1, 'margin': -3.5, 'end': 'two passes', 'stones_captured_by_net': 20, 'stones_lost_by_net': 65}95 {'game': 95, 'opponent': 'strong', 'net_color': 'white', 'result': 1, 'margin': 88.5, 'end': 'move limit', 'stones_captured_by_net': 136, 'stones_lost_by_net': 13}import numpy as np,jsong=json.load(open('/work/pass_1/games.json'))boards=np.load('/work/pass_1/boards.npy')def show(board): z=np.asarray(board).reshape(9,9) return '\n'.join(''.join({0:'.',1:'X',-1:'O'}[int(v)] for v in row) for row in z)for gi in [32,33,67]: x=g[gi] print('\nGAME',gi,x['net_color']) for ply,m in enumerate(x['moves']): if ply<46 and m['by']=='net': print(ply,'move',divmod(m['move'],9),'top',m['top5'][:3]) if ply in [15,31,47,63,len(x['moves'])-1]: print('after',ply,'\n'+show(boards[gi,ply]))
GAME 32 black0 move (6, 4) top [[40, 0.0573], [31, 0.0477], [39, 0.0477]]2 move (4, 2) top [[49, 0.1064], [31, 0.0493], [39, 0.0493]]4 move (4, 3) top [[39, 0.1092], [49, 0.1092], [47, 0.0496]]6 move (6, 6) top [[57, 0.1473], [47, 0.1402], [41, 0.1202]]8 move (3, 3) top [[47, 0.1645], [31, 0.113], [41, 0.1054]]10 move (7, 4) top [[67, 0.9435], [50, 0.0193], [31, 0.0086]]12 move (7, 5) top [[41, 0.3651], [31, 0.133], [51, 0.1078]]14 move (3, 5) top [[41, 0.3265], [56, 0.1603], [31, 0.1341]]after 15 ..............................X.X.....XXOO.....OOOO......OXOX......XX............16 move (3, 4) top [[31, 0.3286], [56, 0.1836], [51, 0.1144]]18 move (3, 2) top [[56, 0.2783], [51, 0.2124], [66, 0.08]]20 move (3, 1) top [[56, 0.2963], [51, 0.1881], [66, 0.1073]]22 move (7, 2) top [[51, 0.233], [66, 0.1588], [46, 0.0652]]24 move (2, 3) top [[66, 0.354], [46, 0.0673], [33, 0.0611]]26 move (2, 0) top [[22, 0.1077], [46, 0.0968], [23, 0.0872]]28 move (1, 3) top [[33, 0.1054], [22, 0.0979], [23, 0.0954]]30 move (2, 1) top [[23, 0.1052], [22, 0.1041], [46, 0.1]]after 31 ............X.....XX.X......XXXXXOO...XXOOO....OOOO.....OOXOXO...XOXXOO..........32 move (2, 6) top [[20, 0.1451], [23, 0.0963], [22, 0.0916]]34 move (2, 5) top [[23, 0.2126], [20, 0.1088], [22, 0.0955]]36 move (3, 8) top [[22, 0.2204], [20, 0.1162], [46, 0.0861]]38 move (1, 6) top [[22, 0.2078], [20, 0.1096], [46, 0.0812]]40 move (5, 1) top [[22, 0.1878], [20, 0.1116], [14, 0.101]]42 move (1, 5) top [[22, 0.1719], [37, 0.1366], [55, 0.1064]]44 move (8, 7) top [[22, 0.2068], [37, 0.1816], [55, 0.1414]]after 47 ............X.XXO.XX.X.XXOO.XXXXXOOX.XXXOOOO..XOOOO...O.OO.OXO...XO..OO....OOO.X.after 63 .........OO.XXXXOOXXXXXXXOO.XXXXXOOXXXXXOOOO.OXOOOO.OXOOOO.OXO.O..O..OO...OOOO.X.after 90 XXXXX.XXO.X.XXXXOOXXXXXXXOO.XXXXXOOOXXXXOOOOOOXOOOO.OOOOOO.OXOOOX.O.OOOOOXOOOO.XO
GAME 33 black0 move (6, 3) top [[40, 0.0573], [31, 0.0477], [39, 0.0477]]2 move (1, 2) top [[48, 0.0752], [58, 0.0712], [39, 0.0633]]4 move (5, 3) top [[48, 0.0911], [58, 0.0871], [39, 0.0606]]6 move (7, 5) top [[59, 0.121], [39, 0.1159], [67, 0.0535]]8 move (4, 6) top [[59, 0.2104], [67, 0.1161], [39, 0.1029]]10 move (3, 6) top [[59, 0.1588], [50, 0.1491], [67, 0.101]]12 move (6, 5) top [[39, 0.2335], [41, 0.1581], [59, 0.106]]14 move (4, 3) top [[39, 0.2232], [50, 0.2072], [41, 0.1902]]after 15 ...........X..........O........OOX.....XO.X.....XO.......XOX......OOX............16 move (4, 5) top [[41, 0.6052], [50, 0.145], [30, 0.0314]]18 move (5, 6) top [[51, 0.9998], [23, 0.0], [30, 0.0]]20 move (3, 3) top [[30, 0.1314], [60, 0.1027], [47, 0.0657]]22 move (5, 2) top [[60, 0.1113], [21, 0.0864], [29, 0.0782]]24 move (8, 3) top [[20, 0.1514], [12, 0.1164], [13, 0.1008]]26 move (2, 2) top [[20, 0.1484], [12, 0.1153], [60, 0.1025]]28 move (8, 5) top [[77, 0.9379], [29, 0.0094], [12, 0.0076]]30 move (0, 6) top [[29, 0.1395], [12, 0.1154], [13, 0.1065]]after 31 ......X....X....O...XOO.O.....XOOXO....XOXX....XXOOXO....XOXO.....OOXO.....X.X...32 move (1, 4) top [[29, 0.1478], [12, 0.1128], [38, 0.1011]]34 move (8, 4) top [[12, 0.1912], [70, 0.155], [29, 0.1207]]36 move (7, 2) top [[65, 0.9899], [74, 0.0084], [70, 0.0003]]38 move (8, 2) top [[74, 0.8989], [12, 0.0269], [70, 0.0191]]40 move (1, 6) top [[12, 0.2538], [70, 0.1807], [29, 0.1223]]42 move (1, 3) top [[12, 0.9976], [70, 0.0006], [29, 0.0004]]44 move (0, 3) top [[3, 0.9988], [70, 0.0003], [56, 0.0002]]after 47 ...XOO.O...XXXO.O...XOO.O.....XOO.O...XXO..O...XXOO.O....XOXOO...XOOXOO..OXXXX...after 63 .X.XOOOO.X.XXXO.O..XXOO.O..X.XXOO.O...XXO..OO..XXOO.O...XXOXOOO.XXOOXOO.X.XXXXOO.after 76 .X.XOOOO.X.XXXOOOX.XXOO.O.XX.XXOO.OO.XXXO..OOXXXXOO.O.X.XXOXOOO.XXOOXOOOX.XXXXOO.
GAME 67 white1 move (4, 5) top [[31, 0.0573], [39, 0.0573], [41, 0.0573]]3 move (4, 6) top [[32, 0.0941], [50, 0.077], [42, 0.0733]]5 move (5, 5) top [[32, 0.0851], [50, 0.0809], [49, 0.0769]]7 move (4, 7) top [[49, 0.2713], [33, 0.1153], [39, 0.1081]]9 move (5, 4) top [[49, 0.2668], [39, 0.1235], [33, 0.1136]]11 move (2, 4) top [[39, 0.1935], [33, 0.1309], [22, 0.0925]]13 move (2, 5) top [[39, 0.237], [23, 0.1758], [33, 0.1155]]15 move (2, 2) top [[39, 0.2814], [33, 0.1125], [48, 0.1034]]after 15 ....................OXOO.....XXXX.......XOOO.....OO......XX......................17 move (2, 1) top [[39, 0.5743], [38, 0.067], [33, 0.0653]]19 move (6, 5) top [[39, 0.5392], [33, 0.075], [38, 0.0615]]21 move (4, 3) top [[39, 0.5267], [33, 0.0749], [38, 0.0661]]23 move (4, 2) top [[38, 0.2233], [48, 0.194], [33, 0.1655]]25 move (3, 6) top [[33, 0.9998], [48, 0.0001], [37, 0.0]]27 move (4, 1) top [[47, 0.2574], [37, 0.151], [56, 0.0933]]29 move (3, 0) top [[27, 0.9957], [47, 0.0011], [51, 0.0004]]31 move (6, 2) top [[47, 0.3041], [56, 0.1033], [51, 0.0916]]after 31 ...........XX.X....OOXOOX..OXXXXXO...OOOXOOO..X.XOO.....OXXO.......X.............33 move (4, 0) top [[36, 0.9595], [55, 0.0067], [51, 0.0052]]35 move (1, 1) top [[9, 0.6574], [10, 0.3398], [55, 0.0005]]37 move (1, 0) top [[9, 0.8707], [65, 0.1277], [51, 0.0003]]39 move (7, 2) top [[65, 0.9877], [51, 0.0023], [66, 0.0018]]41 move (3, 0) top [[27, 0.9997], [66, 0.0001], [51, 0.0]]43 move (4, 1) top [[37, 0.2263], [66, 0.1673], [51, 0.1004]]45 move (4, 2) top [[38, 0.7685], [66, 0.0543], [51, 0.0326]]after 47 .X.......OOXX.XX...OOXOOX..OXXXXXOO..OOXXOOO.XXXXOO....XOXXO.....O.X.............after 63 .XXX.....OOXX.XXO..OOXOOXO.OXXXXXOOXX..XXOOO.XXXXOOOOO.XOXXO.XOXOOXXO.X..........after 92 XXXX.OO.O.XXXXXXO.X..X.XXOO.XXXXXOO.X.XXXOOOOXXXXOOOOOXX.XXO.OOX.XXXOOO.X.XXOO.OOimport jsonsrc=open('/work/design.py').read()src=src.replace("safe2=1., safe3=1., cap_safety=1.)", "safe2=1., safe3=1., cap_safety=1., crowd=0., temperature_scale=1.)")src=src.replace("b(5,E,1-len(adj[q]))","b(5,E,2-len(adj[q]))")src=src.replace("""w(6,E,u(4,q),p['eye']) w(6,I,u(4,q),p['isolation']) w(6,P,u(5,q),1)""","""w(6,E,u(4,q),1); b(6,u(4,q),-1) w(6,P,u(5,q),1) b(6,u(5,q),100) w(6,E,u(5,q),-p['crowd']) w(6,I,u(5,q),-p['isolation'])""")src=src.replace("p['save'],-p['danger'],-1.,1.]", "p['save'],-p['danger'],-(p['eye']-2*p['crowd']),1.]")src=src.replace("a['out.b'][q]=-40.","a['out.b'][q]=-140.")src=src.replace("return a,p","a['out.W'] *= p['temperature_scale']\n a['out.b'] *= p['temperature_scale']\n return a,p")open('/work/design_v2.py','w').write(src)exec(src)config=install(dict(own_adj=2.,opp_adj=.6,crowd=3.,temperature_scale=1.5,opening=3.))json.dump(config,open('/work/config_v2.json','w'),indent=2)print(config){'capture': 11.0, 'capture_extra': 3.0, 'save': 7.0, 'danger': 10.0, 'eye': 22.0, 'isolation': 3.0, 'isolation_threshold': 2.5, 'base': 1.3, 'pass_bias': -1.0, 'attack': 1.3, 'own_adj': 2.0, 'opp_adj': 0.6, 'opening': 3.0, 'save_danger': 2.0, 'safe2': 1.0, 'safe3': 1.0, 'cap_safety': 1.0, 'crowd': 3.0, 'temperature_scale': 1.5}{"games":{"strong":96,"weak":24,"random":8}}{"ok": true, "pass": 2, "kind": "games", "per_opponent": {"random": {"games": 8, "score": 1.0, "wins": 8, "losses": 0, "score_as_black": 1.0, "score_as_white": 1.0, "mean_margin": 81.0, "mean_length": 128.0, "stones_captured_per_game": 101.375, "stones_lost_per_game": 0.5, "passes_per_game": 1.125, "games_with_a_pass_before_move_60": 0, "end_two_passes": 8, "end_repetition": 0, "end_move_limit": 0}, "strong": {"games": 96, "score": 0.5729166865348816, "wins": 55, "losses": 41, "score_as_black": 0.4166666567325592, "score_as_white": 0.7291666865348816, "mean_margin": 34.52083206176758, "mean_length": 117.09375, "stones_captured_per_game": 58.21875, "stones_lost_per_game": 12.854166666666666, "passes_per_game": 3.4583333333333335, "games_with_a_pass_before_move_60": 0, "end_two_passes": 87, "end_repetition": 6, "end_move_limit": 3}, "weak": {"games": 24, "score": 0.9583333134651184, "wins": 23, "losses": 1, "score_as_black": 1.0, "score_as_white": 0.9166666865348816, "mean_margin": 77.91666412353516, "mean_length": 131.16666666666666, "stones_captured_per_game": 92.45833333333333, "stones_lost_per_game": 3.0, "passes_per_game": 3.25, "games_with_a_pass_before_move_60": 0, "end_two_passes": 22, "end_repetition": 1, "end_move_limit": 1}}, "files": "/work/pass_2/", "readme": "games.json: one entry per game (opponent, net_color, result +1/-1, margin = net's area score minus the opponent's incl. komi, end, stones captured / lost, moves: ply, by, move (row*9+col, 81 = pass), and for the network's moves its top-5 [move, probability]). boards.npy: (games, 162, 81) int8, the board AFTER each ply (1 Black, -1 White, 0 empty; index row*9+col); valid.npy: (games, 162) which plies were played."}import json,numpy as npg=json.load(open('/work/pass_2/games.json')); boards=np.load('/work/pass_2/boards.npy')def show(b): return '\n'.join(''.join({0:'.',1:'X',-1:'O'}[int(v)] for v in row) for row in np.asarray(b).reshape(9,9))loss=[i for i,x in enumerate(g) if x['opponent']=='strong' and x['result']<0]print('Strong losses',[(i,g[i]['margin'],g[i]['end'],g[i]['stones_lost_by_net']) for i in loss])for gi in loss[:3]: x=g[gi] print('\nGAME',gi,x['net_color']) for ply,m in enumerate(x['moves']): if ply<38 and m['by']=='net': print(ply,m['move'],m['top5'][:3]) if ply in [15,31,47,63,len(x['moves'])-1]: print('after',ply,'\n'+show(boards[gi,ply]))for gi,x in enumerate(g): if x['end']=='repetition': print('\nREPETITION',gi,x['result'],x['net_color'],x['margin']) for m in x['moves'][-9:]: print(m) print(show(boards[gi,len(x['moves'])-4])) breakStrong losses [(8, -1.5, 'two passes', 22), (10, -18.5, 'two passes', 16), (13, -1.5, 'two passes', 17), (14, -34.5, 'two passes', 30), (16, -23.5, 'two passes', 41), (18, -25.5, 'two passes', 25), (19, -20.5, 'two passes', 11), (22, -24.5, 'two passes', 19), (23, -20.5, 'two passes', 28), (25, -32.5, 'two passes', 18), (26, -4.5, 'repetition', 14), (30, -34.5, 'two passes', 23), (33, -15.5, 'two passes', 15), (34, -21.5, 'two passes', 18), (35, -23.5, 'two passes', 14), (36, -23.5, 'two passes', 11), (40, -20.5, 'two passes', 9), (41, 26.5, 'repetition', 4), (43, -8.5, 'two passes', 12), (44, -13.5, 'two passes', 8), (45, -26.5, 'two passes', 15), (47, -2.5, 'two passes', 31), (48, -16.5, 'two passes', 28), (49, -18.5, 'two passes', 8), (50, -19.5, 'two passes', 9), (52, 10.5, 'repetition', 9), (54, -24.5, 'two passes', 36), (55, -14.5, 'two passes', 9), (58, 46.5, 'repetition', 3), (62, -1.5, 'two passes', 20), (65, -25.5, 'two passes', 32), (68, -29.5, 'two passes', 42), (74, -8.5, 'two passes', 19), (78, -17.5, 'two passes', 32), (83, -4.5, 'two passes', 16), (84, -20.5, 'two passes', 25), (85, -3.5, 'two passes', 26), (88, -49.5, 'two passes', 73), (91, -14.5, 'repetition', 24), (96, -17.5, 'repetition', 42), (101, -11.5, 'two passes', 23)]
GAME 8 black0 41 [[40, 0.1021], [31, 0.0728], [39, 0.0728]]2 32 [[32, 0.2743], [50, 0.2743], [42, 0.2246]]4 39 [[50, 0.1892], [39, 0.16], [49, 0.1485]]6 48 [[30, 0.7037], [49, 0.0929], [48, 0.0566]]8 38 [[30, 0.8021], [42, 0.029], [38, 0.0232]]10 30 [[30, 0.4964], [47, 0.3622], [57, 0.0344]]12 47 [[47, 0.4183], [59, 0.279], [29, 0.2067]]14 42 [[29, 0.3382], [59, 0.3233], [56, 0.1913]]after 15 .......................O......XOXO....XXOXX....XXOO......OO......................16 51 [[51, 0.3109], [29, 0.2597], [59, 0.2074]]18 29 [[29, 0.2898], [21, 0.2314], [59, 0.1714]]20 21 [[21, 0.2857], [59, 0.2459], [24, 0.1891]]22 56 [[59, 0.318], [20, 0.304], [56, 0.2539]]24 52 [[52, 0.9996], [20, 0.0003], [34, 0.0]]26 66 [[20, 0.4276], [61, 0.2713], [34, 0.195]]28 67 [[67, 0.3197], [61, 0.2657], [34, 0.184]]30 34 [[61, 0.322], [65, 0.2148], [34, 0.2084]]after 31 ....................OXOOOO...XXOXOX...XXOXXO...XXOOXX...XOOOO.....XXO............32 44 [[44, 0.969], [35, 0.0308], [61, 0.0001]]34 61 [[65, 0.4443], [61, 0.3443], [13, 0.0285]]36 13 [[65, 0.6775], [13, 0.0435], [12, 0.0404]]after 47 ...X.O.....X.XXO....OXOOOOX..XXOXOX...XXOXX.X..XXOOXX...XOOOOX....XXOOOX.........after 63 ...XX.X....X.XXOOO.X.XOOOO..XXXOXO.O.XXXOXXO..XXXOOXXO..XOOOOXX..XXXOOOX.....O.O.after 113 XX.XXOOO.XXX.XXOOO.X.XOOOOOXXXXOXOOO.XXXOX.OOXXXXOO..OXXXOOOOOO.XXXXOOOOX.X.XOOOO
GAME 10 black0 30 [[40, 0.1021], [31, 0.0728], [39, 0.0728]]2 39 [[31, 0.3896], [39, 0.3896], [21, 0.0583]]4 48 [[31, 0.4146], [48, 0.3269], [38, 0.0891]]6 31 [[31, 0.8345], [57, 0.0448], [41, 0.0374]]8 22 [[32, 0.1506], [41, 0.1401], [50, 0.1356]]10 41 [[21, 0.5675], [41, 0.1163], [50, 0.0832]]12 50 [[50, 0.6894], [21, 0.1855], [42, 0.0328]]14 21 [[21, 0.5772], [42, 0.1008], [51, 0.0846]]after 15 .....................XX.......XXOO.....XOX......XOX.....OOOO.....................16 67 [[42, 0.2071], [51, 0.176], [23, 0.1658]]18 29 [[42, 0.1886], [51, 0.1672], [23, 0.1529]]20 38 [[38, 0.503], [20, 0.1272], [51, 0.1243]]22 20 [[47, 0.6433], [66, 0.1299], [20, 0.0836]]24 46 [[47, 0.634], [23, 0.1669], [66, 0.1631]]26 66 [[47, 0.684], [66, 0.1231], [23, 0.1148]]28 47 [[47, 0.821], [23, 0.0976], [37, 0.0487]]30 24 [[24, 0.4564], [37, 0.3137], [64, 0.0876]]after 31 ....................XXXOXO...XXXOO....XXOXO...XXXOX....OOOOOO....OXXOO...........32 15 [[15, 0.9994], [37, 0.0004], [64, 0.0001]]34 37 [[37, 0.5084], [14, 0.2588], [43, 0.0441]]36 28 [[34, 0.3574], [14, 0.3316], [28, 0.1714]]after 47 .....XXO.....OOXOO.XXXXOXO..XXXXOOXX.XXXOXOO..XXXOX.O..OOOOOO...OOXXOO...........after 63 .O..O..O.OXXXOO.OOOXXXXO.O.XXXXXOOXX.XXXOXOOOXXXXOX.OO.OOOOOO...OOXXOO....X.XX...after 102 X.XXO..O.XXXXOOOOO.XXXXOOO.XXXXXOOXX.XXXO.OOOXXXXOOOOOXOOOOOOOOXOOOXOOOOOOOO.XXXO
GAME 13 black0 42 [[40, 0.1021], [31, 0.0728], [39, 0.0728]]2 33 [[41, 0.6113], [33, 0.0914], [51, 0.0914]]4 41 [[41, 0.4722], [32, 0.1632], [51, 0.1458]]6 32 [[32, 0.9234], [50, 0.0384], [51, 0.0149]]8 30 [[50, 0.405], [39, 0.1626], [51, 0.1011]]10 22 [[50, 0.3237], [48, 0.2471], [51, 0.0814]]12 29 [[29, 0.9991], [23, 0.0006], [50, 0.0001]]14 13 [[13, 0.9958], [38, 0.0017], [20, 0.0008]]after 15 .............X......OOXO.....XXOXX.....OOXX......O........O......................16 51 [[38, 0.5617], [24, 0.1266], [50, 0.0857]]18 14 [[50, 0.6594], [38, 0.2206], [24, 0.0437]]20 24 [[24, 1.0], [50, 0.0], [38, 0.0]]22 50 [[50, 0.6677], [38, 0.2948], [15, 0.0137]]24 38 [[38, 0.7332], [60, 0.1572], [15, 0.0429]]26 47 [[47, 0.6784], [60, 0.186], [15, 0.054]]28 28 [[46, 0.4999], [28, 0.4999], [60, 0.0001]]30 55 [[60, 0.4565], [19, 0.2951], [15, 0.1502]]after 31 ...........OOXX.....OOX.X...XXXOXX...OXOOXX...OXOOXX...XOOOO.....................32 15 [[60, 0.5083], [19, 0.2588], [15, 0.1486]]34 60 [[60, 0.5681], [19, 0.2893], [54, 0.0531]]36 34 [[19, 0.5592], [54, 0.1494], [27, 0.1248]]after 47 ...........OOXXXX..OOOX.XX.O...OXXX.OO.OOXXXOOO.OOXXX.XXOOOOXO.......OO..........after 63 ...X.OX....OOXXXXO.OOOX.XXOO...OXXX.OO.OOXXXOOO.OOXXX.XXOOOOXO.XXO.OXOO..X.O.XXO.after 103 OXXXX.X.X.OOOXXXXXOOOOX.XX.OO..OXXXXOO.OOXXX.OO.OOXXXX.OOOOOXX.XOOOOX.XXOOOOXXX.X
REPETITION 26 -1 black -4.5{'ply': 82, 'by': 'net', 'move': 1, 'top5': [[1, 0.8154], [81, 0.141], [67, 0.0174], [70, 0.0116], [0, 0.0105]]}{'ply': 83, 'by': 'opponent', 'move': 71}{'ply': 84, 'by': 'net', 'move': 81, 'top5': [[81, 0.873], [67, 0.1077], [32, 0.0157], [68, 0.0036], [72, 0.0]]}{'ply': 85, 'by': 'opponent', 'move': 53}{'ply': 86, 'by': 'net', 'move': 67, 'top5': [[81, 0.873], [67, 0.1077], [32, 0.0157], [68, 0.0036], [72, 0.0]]}{'ply': 87, 'by': 'opponent', 'move': 76}{'ply': 88, 'by': 'net', 'move': 72, 'top5': [[72, 1.0], [81, 0.0], [32, 0.0], [68, 0.0], [46, 0.0]]}{'ply': 89, 'by': 'opponent', 'move': 54}{'ply': 90, 'by': 'net', 'move': 63, 'top5': [[63, 1.0], [81, 0.0], [32, 0.0], [46, 0.0], [72, 0.0]]}.XX.XXOO.XXXX.XOOO.XXXXXXOOXXXXX.XOO.XXXOXOOOX.XXOXOOO.XOOOXOOOXOOOX.O.O.OOOOOO.Oimport jsonsrc=open('/work/design_v2.py').read()src=src.replace("temperature_scale=1.)","temperature_scale=1., defend=0., first_center=0.)")src=src.replace("w(1,2,487,1)","""w(1,2,487,1) b(1,488,1) for q in range(81): w(1,3*q,488,-1) w(1,3*q+1,488,-1)""")src=src.replace("w(k,486,486,1); w(k,487,487,1)", "w(k,486,486,1); w(k,487,487,1); w(k,488,488,1)")src=src.replace("w(5,486,P,p['opening']*central)","""w(5,486,P,p['opening']*central) if q==40: w(5,488,P,p['first_center'])""")src=src.replace("w(5,u(3,t),P,-p['attack'])","""w(5,u(3,t),P,-p['attack']) w(5,u(4,t),P,p['defend']) w(5,u(2,t),P,-p['defend'])""")open('/work/design_v3.py','w').write(src)exec(src)config=install(dict(own_adj=2.,opp_adj=1.5,crowd=3.,temperature_scale=1.5, opening=3.,defend=1.,first_center=20.))json.dump(config,open('/work/config_v3.json','w'),indent=2)print(config){'capture': 11.0, 'capture_extra': 3.0, 'save': 7.0, 'danger': 10.0, 'eye': 22.0, 'isolation': 3.0, 'isolation_threshold': 2.5, 'base': 1.3, 'pass_bias': -1.0, 'attack': 1.3, 'own_adj': 2.0, 'opp_adj': 1.5, 'opening': 3.0, 'save_danger': 2.0, 'safe2': 1.0, 'safe3': 1.0, 'cap_safety': 1.0, 'crowd': 3.0, 'temperature_scale': 1.5, 'defend': 1.0, 'first_center': 20.0}{"games":{"strong":96,"weak":24,"random":8}}{"ok": true, "pass": 3, "kind": "games", "per_opponent": {"random": {"games": 8, "score": 1.0, "wins": 8, "losses": 0, "score_as_black": 1.0, "score_as_white": 1.0, "mean_margin": 79.375, "mean_length": 130.25, "stones_captured_per_game": 100.375, "stones_lost_per_game": 1.0, "passes_per_game": 1.875, "games_with_a_pass_before_move_60": 0, "end_two_passes": 8, "end_repetition": 0, "end_move_limit": 0}, "strong": {"games": 96, "score": 0.5520833134651184, "wins": 53, "losses": 43, "score_as_black": 0.4583333432674408, "score_as_white": 0.6458333134651184, "mean_margin": 35.35416793823242, "mean_length": 110.35416666666667, "stones_captured_per_game": 47.5, "stones_lost_per_game": 11.322916666666666, "passes_per_game": 1.875, "games_with_a_pass_before_move_60": 0, "end_two_passes": 91, "end_repetition": 5, "end_move_limit": 0}, "weak": {"games": 24, "score": 1.0, "wins": 24, "losses": 0, "score_as_black": 1.0, "score_as_white": 1.0, "mean_margin": 81.0, "mean_length": 127.25, "stones_captured_per_game": 88.75, "stones_lost_per_game": 2.1666666666666665, "passes_per_game": 1.5, "games_with_a_pass_before_move_60": 0, "end_two_passes": 24, "end_repetition": 0, "end_move_limit": 0}}, "files": "/work/pass_3/", "readme": "games.json: one entry per game (opponent, net_color, result +1/-1, margin = net's area score minus the opponent's incl. komi, end, stones captured / lost, moves: ply, by, move (row*9+col, 81 = pass), and for the network's moves its top-5 [move, probability]). boards.npy: (games, 162, 81) int8, the board AFTER each ply (1 Black, -1 White, 0 empty; index row*9+col); valid.npy: (games, 162) which plies were played."}import numpy as np,json,collectionsg=json.load(open('/work/pass_3/games.json')); boards=np.load('/work/pass_3/boards.npy')adj=[[j for j in (q-9,q+9,q-1,q+1) if 0<=j<81 and abs(j//9-q//9)+abs(j%9-q%9)==1] for q in range(81)]def groups(b): info={} for q in range(81): if b[q]==0 or q in info: continue stack=[q]; stones={q}; libs=set() while stack: t=stack.pop() for v in adj[t]: if b[v]==0: libs.add(v) elif b[v]==b[q] and v not in stones: stones.add(v);stack.append(v) for t in stones: info[t]=(stones,libs) return infobad=[]; stats=collections.Counter()for gi,x in enumerate(g): if x['opponent']!='strong':continue color=1 if x['net_color']=='black' else -1 for pi,m in enumerate(x['moves']): if m['by']!='net' or m['move']==81:continue before=np.zeros(81,np.int8) if pi==0 else boards[gi,pi-1] after=boards[gi,pi]; gr=groups(before);q=m['move'] caps=sum(before==-color)-sum(after==-color) save=any(before[t]==color and len(gr[t][1])==1 for t in adj[q]) atari_after=groups(after).get(q,(set(),set()))[1] stats['moves']+=1 if len(atari_after)==1: stats['self_atari']+=1 if caps==0:stats['noncapture_self_atari']+=1 if m['top5'][0][0]==q and m['top5'][0][1]>.95 and caps==0 and not save: bad.append((gi,pi,q,len(atari_after),x['result'],m['top5'][:2]))print(stats)print('Confident, no capture or atari save:',len(bad))print(bad[:30])for gi,pi,q,libs,res,top in bad[:4]: print('\n',gi,pi,q,libs,res,top) print('\n'.join(''.join({0:'.',1:'X',-1:'O'}[int(v)] for v in row) for row in boards[gi,pi-1].reshape(9,9)))Counter({'moves': 5123, 'self_atari': 251, 'noncapture_self_atari': 141})Confident, no capture or atari save: 605[(8, 0, 40, 4, -1, [[40, 1.0], [31, 0.0]]), (8, 46, 5, 2, -1, [[5, 0.9883], [4, 0.0113]]), (8, 62, 37, 8, -1, [[37, 0.9565], [46, 0.0257]]), (8, 64, 46, 8, -1, [[46, 0.9982], [36, 0.0009]]), (8, 66, 55, 8, -1, [[55, 0.9827], [36, 0.0159]]), (8, 72, 27, 1, -1, [[27, 1.0], [77, 0.0]]), (8, 74, 77, 2, -1, [[77, 0.9861], [66, 0.0105]]), (8, 76, 76, 3, -1, [[76, 0.9999], [67, 0.0001]]), (8, 78, 67, 2, -1, [[67, 0.9958], [75, 0.004]]), (8, 82, 2, 1, -1, [[2, 1.0], [78, 0.0]]), (8, 84, 78, 2, -1, [[78, 0.9661], [77, 0.0333]]), (8, 86, 79, 1, -1, [[79, 1.0], [77, 0.0]]), (8, 88, 76, 2, -1, [[76, 0.9575], [81, 0.0412]]), (8, 90, 67, 1, -1, [[67, 1.0], [81, 0.0]]), (9, 0, 40, 4, 1, [[40, 1.0], [31, 0.0]]), (9, 26, 67, 1, 1, [[67, 1.0], [38, 0.0]]), (9, 58, 35, 15, 1, [[35, 0.9978], [2, 0.0022]]), (9, 68, 8, 1, 1, [[8, 0.9996], [66, 0.0003]]), (9, 100, 25, 23, 1, [[25, 0.952], [23, 0.0125]]), (9, 106, 15, 22, 1, [[15, 0.9964], [69, 0.0027]]), (10, 0, 40, 4, -1, [[40, 1.0], [31, 0.0]]), (10, 38, 43, 2, -1, [[43, 1.0], [20, 0.0]]), (10, 56, 16, 6, -1, [[16, 0.9638], [28, 0.0151]]), (10, 62, 54, 1, -1, [[54, 1.0], [19, 0.0]]), (10, 66, 76, 1, -1, [[76, 1.0], [19, 0.0]]), (10, 70, 27, 6, -1, [[27, 1.0], [19, 0.0]]), (10, 74, 19, 3, -1, [[19, 0.9927], [61, 0.0042]]), (10, 76, 4, 1, -1, [[4, 0.9949], [9, 0.0051]]), (11, 0, 40, 4, -1, [[40, 1.0], [31, 0.0]]), (11, 34, 38, 9, -1, [[38, 0.9635], [67, 0.0117]])]
8 0 40 4 -1 [[40, 1.0], [31, 0.0]].O.OOXX.XOO.OOOXX.OOOOOOX.XOOXXXXXX.OXXXXXX.XOXXXOXXX.OXOOOOXXXOOOOXOOOO.OOOX.XXO
8 46 5 2 -1 [[5, 0.9883], [4, 0.0113]]............OXOX....OOOOXO..OXXXXXX...XXXXX.X..XXOXXX...OOOOXXX.....OOOO.........
8 62 37 8 -1 [[37, 0.9565], [46, 0.0257]].O.OOXX.XO..OOOXX..OOOOOX.X.OXXXXXX...XXXXX.X..XXOXXX...OOOOXXX..O..OOOO.........
8 64 46 8 -1 [[46, 0.9982], [36, 0.0009]].O.OOXX.XO..OOOXX..OOOOOX.X.OXXXXXX..XXXXXX.XO.XXOXXX...OOOOXXX..O..OOOO.........import jsonsrc=open('/work/design_v3.py').read()src=src.replace("first_center=0.)","first_center=0., triangle=0.)")# White was unused. Reuse its global slot for the empty-board indicator,# leaving 24 final-layer-4 units for symmetric central shape features.src=src.replace("w(1,2,487,1)\n b(1,488,1)","b(1,487,1)")src=src.replace("w(1,3*q,488,-1)","w(1,3*q,487,-1)")src=src.replace("w(1,3*q+1,488,-1)","w(1,3*q+1,487,-1)")src=src.replace("; w(k,488,488,1)","")src=src.replace("w(5,488,P,p['first_center'])","w(5,487,P,p['first_center'])")src=src.replace(" line=[-1.2",''' central_points=[q for q,(r,c) in enumerate(xy) if 2<=r<=6 and 2<=c<=6 and q!=40] shape_units={q:488+i for i,q in enumerate(central_points)} for q,j in shape_units.items(): r,c=xy[q] b(4,j,-2) for t in adj[q]: w(4,u(0,t),j,1) for dr,dc in [(-1,-1),(-1,1),(1,-1),(1,1)]: w(4,u(0,(r+dr)*9+c+dc),j,1) line=[-1.2''')src=src.replace("central=max(0.",'''if q in shape_units: w(5,shape_units[q],P,-p['triangle']) central=max(0.''')open('/work/design_v4.py','w').write(src)exec(src)config=install(dict(own_adj=2.,opp_adj=1.5,crowd=3.,temperature_scale=2.5, opening=3.,defend=1.,first_center=20.,triangle=1.5))json.dump(config,open('/work/config_v4.json','w'),indent=2)print(config){'capture': 11.0, 'capture_extra': 3.0, 'save': 7.0, 'danger': 10.0, 'eye': 22.0, 'isolation': 3.0, 'isolation_threshold': 2.5, 'base': 1.3, 'pass_bias': -1.0, 'attack': 1.3, 'own_adj': 2.0, 'opp_adj': 1.5, 'opening': 3.0, 'save_danger': 2.0, 'safe2': 1.0, 'safe3': 1.0, 'cap_safety': 1.0, 'crowd': 3.0, 'temperature_scale': 2.5, 'defend': 1.0, 'first_center': 20.0, 'triangle': 1.5}{"games":{"strong":96,"weak":24,"random":8}}{"ok": true, "pass": 4, "kind": "games", "per_opponent": {"random": {"games": 8, "score": 1.0, "wins": 8, "losses": 0, "score_as_black": 1.0, "score_as_white": 1.0, "mean_margin": 81.0, "mean_length": 121.0, "stones_captured_per_game": 94.75, "stones_lost_per_game": 0.125, "passes_per_game": 1.0, "games_with_a_pass_before_move_60": 0, "end_two_passes": 8, "end_repetition": 0, "end_move_limit": 0}, "strong": {"games": 96, "score": 0.7916666865348816, "wins": 76, "losses": 20, "score_as_black": 0.7291666865348816, "score_as_white": 0.8541666865348816, "mean_margin": 60.09375, "mean_length": 118.08333333333333, "stones_captured_per_game": 67.73958333333333, "stones_lost_per_game": 8.5625, "passes_per_game": 1.5208333333333333, "games_with_a_pass_before_move_60": 0, "end_two_passes": 89, "end_repetition": 7, "end_move_limit": 0}, "weak": {"games": 24, "score": 0.9583333134651184, "wins": 23, "losses": 1, "score_as_black": 0.9166666865348816, "score_as_white": 1.0, "mean_margin": 74.625, "mean_length": 124.95833333333333, "stones_captured_per_game": 84.25, "stones_lost_per_game": 3.1666666666666665, "passes_per_game": 2.4166666666666665, "games_with_a_pass_before_move_60": 0, "end_two_passes": 23, "end_repetition": 1, "end_move_limit": 0}}, "files": "/work/pass_4/", "readme": "games.json: one entry per game (opponent, net_color, result +1/-1, margin = net's area score minus the opponent's incl. komi, end, stones captured / lost, moves: ply, by, move (row*9+col, 81 = pass), and for the network's moves its top-5 [move, probability]). boards.npy: (games, 162, 81) int8, the board AFTER each ply (1 Black, -1 White, 0 empty; index row*9+col); valid.npy: (games, 162) which plies were played."}import json,numpy as np,collectionsg=json.load(open('/work/pass_4/games.json')); boards=np.load('/work/pass_4/boards.npy')def show(b): return '\n'.join(''.join({0:'.',1:'X',-1:'O'}[int(v)] for v in row) for row in np.asarray(b).reshape(9,9))for i,x in enumerate(g): if x['result']<0: print(i,x['opponent'],x['net_color'],x['margin'],x['end'], 'caps/lost',x['stones_captured_by_net'],x['stones_lost_by_net'])print('\nREPETITION DETAILS')for gi,x in enumerate(g): if x['end']!='repetition':continue n=len(x['moves']) print('\nGAME',gi,x['result'],x['net_color'],x['margin']) for pi in range(max(0,n-5),n): print(x['moves'][pi]) print(show(boards[gi,pi])) if gi>30:break12 strong black -16.5 two passes caps/lost 5 1715 strong black 6.5 repetition caps/lost 13 817 strong black -25.5 two passes caps/lost 21 5321 strong black -3.5 two passes caps/lost 8 2122 strong black -4.5 two passes caps/lost 15 1735 strong black -6.5 two passes caps/lost 24 3637 strong black -14.5 two passes caps/lost 6 1539 strong black -16.5 two passes caps/lost 32 7241 strong black 1.5 repetition caps/lost 7 443 strong black -16.5 two passes caps/lost 17 3044 strong black -0.5 two passes caps/lost 20 4645 strong black 2.5 repetition caps/lost 18 1350 strong black -13.5 two passes caps/lost 3 957 strong white 49.5 repetition caps/lost 50 468 strong white -7.5 two passes caps/lost 8 3979 strong white -11.5 two passes caps/lost 9 2582 strong white 7.5 repetition caps/lost 3 488 strong white 37.5 repetition caps/lost 42 1090 strong white -13.5 repetition caps/lost 14 3493 strong white -2.5 two passes caps/lost 16 49106 weak black 16.5 repetition caps/lost 39 14
REPETITION DETAILS
GAME 15 -1 black 6.5{'ply': 84, 'by': 'net', 'move': 18, 'top5': [[18, 1.0], [72, 0.0], [8, 0.0], [81, 0.0], [80, 0.0]]}.X.X.XXO.XXX.XXXXXXXXXXXOOXOXX.XOOOOOOXXXXOOOOOOOOOO..OOOXOXXOOOOXXX.XOO.X.X.X.X.{'ply': 85, 'by': 'opponent', 'move': 52}.X.X.XXO.XXX.XXXXXXXXXXXOOXOXX.XOOOOOOXXXXOOOOOOOOOOO.OOOXOXXOOOOXXX.XOO.X.X.X.X.{'ply': 86, 'by': 'net', 'move': 72, 'top5': [[72, 1.0], [8, 0.0], [81, 0.0], [80, 0.0], [68, 0.0]]}.X.X.XXO.XXX.XXXXXXXXXXXOOXOXX.XOOOOOOXXXXOOOOOOOOOOO.OOOXOXXOOOOXXX.XOOXX.X.X.X.{'ply': 87, 'by': 'opponent', 'move': 74}.X.X.XXO.XXX.XXXXXXXXXXXOOXOXX.XOOOOOOXXXXOOOOOOOOOOO.OOOXOXXOOOOXXX.XOO..OX.X.X.{'ply': 88, 'by': 'net', 'move': 73, 'top5': [[73, 1.0], [8, 0.0], [81, 0.0], [80, 0.0], [72, 0.0]]}.X.X.XXO.XXX.XXXXXXXXXXXOOXOXX.XOOOOOOXXXXOOOOOOOOOOO.OOOXOXXOOOOXXX.XOO.X.X.X.X.
GAME 41 -1 black 1.5{'ply': 48, 'by': 'net', 'move': 13, 'top5': [[13, 0.9998], [44, 0.0001], [62, 0.0001], [68, 0.0], [67, 0.0]]}..........XOOXXOX..XOOOO.O.X.XXOOXO..X.XXX.X..XXXOOXXOXOOOOXXX...................{'ply': 49, 'by': 'opponent', 'move': 4}....O.....XOOXXOX..XOOOO.O.X.XXOOXO..X.XXX.X..XXXOOXXOXOOOOXXX...................{'ply': 50, 'by': 'net', 'move': 24, 'top5': [[24, 1.0], [44, 0.0], [62, 0.0], [68, 0.0], [67, 0.0]]}....O.....XOOXXOX..XOOOOXO.X.XXOOXO..X.XXX.X..XXXOOXXOXOOOOXXX...................{'ply': 51, 'by': 'opponent', 'move': 42}....O.....XOOXXOX..XOOOO.O.X.XXOO.O..X.XXXOX..XXXOOXXOXOOOOXXX...................{'ply': 52, 'by': 'net', 'move': 33, 'top5': [[33, 1.0], [44, 0.0], [62, 0.0], [68, 0.0], [69, 0.0]]}....O.....XOOXXOX..XOOOO.O.X.XXOOXO..X.XXX.X..XXXOOXXOXOOOOXXX...................import jsonsrc=open('/work/design_v4.py').read()src=src.replace("triangle=0.)","triangle=0., capture_guard=0.)")src=src.replace("w(5,u(3,t),D,-p['cap_safety'])","# Captures are accounted for after their reliability gate, in layer 6.")src=src.replace("if wm: w(5,u(0,t),P,wm)","""guard_weight={1:1.,2:1.,3:.5}.get(d,0.)*p['capture_guard'] if guard_weight: w(5,u(1,t),C,-guard_weight) w(5,u(3,t),C,guard_weight) if wm: w(5,u(0,t),P,wm)""")src=src.replace("w(6,D,u(3,q),1)", "w(6,D,u(3,q),1); w(6,C,u(3,q),-p['cap_safety'])")open('/work/design_v5.py','w').write(src)exec(src)cfg=json.load(open('/work/config_v4.json'))cfg['capture_guard']=.2config=install(cfg)json.dump(config,open('/work/config_v5.json','w'),indent=2)print(config){'capture': 11.0, 'capture_extra': 3.0, 'save': 7.0, 'danger': 10.0, 'eye': 22.0, 'isolation': 3.0, 'isolation_threshold': 2.5, 'base': 1.3, 'pass_bias': -1.0, 'attack': 1.3, 'own_adj': 2.0, 'opp_adj': 1.5, 'opening': 3.0, 'save_danger': 2.0, 'safe2': 1.0, 'safe3': 1.0, 'cap_safety': 1.0, 'crowd': 3.0, 'temperature_scale': 2.5, 'defend': 1.0, 'first_center': 20.0, 'triangle': 1.5, 'capture_guard': 0.2}{"games":{"strong":96,"weak":24,"random":8}}{"ok": true, "pass": 5, "kind": "games", "per_opponent": {"random": {"games": 8, "score": 1.0, "wins": 8, "losses": 0, "score_as_black": 1.0, "score_as_white": 1.0, "mean_margin": 66.25, "mean_length": 115.0, "stones_captured_per_game": 82.25, "stones_lost_per_game": 0.0, "passes_per_game": 1.5, "games_with_a_pass_before_move_60": 0, "end_two_passes": 8, "end_repetition": 0, "end_move_limit": 0}, "strong": {"games": 96, "score": 0.8333333134651184, "wins": 80, "losses": 16, "score_as_black": 0.7916666865348816, "score_as_white": 0.875, "mean_margin": 60.47916793823242, "mean_length": 120.0625, "stones_captured_per_game": 75.5, "stones_lost_per_game": 7.052083333333333, "passes_per_game": 2.1041666666666665, "games_with_a_pass_before_move_60": 0, "end_two_passes": 95, "end_repetition": 1, "end_move_limit": 0}, "weak": {"games": 24, "score": 1.0, "wins": 24, "losses": 0, "score_as_black": 1.0, "score_as_white": 1.0, "mean_margin": 75.16666412353516, "mean_length": 123.66666666666667, "stones_captured_per_game": 81.16666666666667, "stones_lost_per_game": 2.7083333333333335, "passes_per_game": 2.0833333333333335, "games_with_a_pass_before_move_60": 0, "end_two_passes": 24, "end_repetition": 0, "end_move_limit": 0}}, "files": "/work/pass_5/", "readme": "games.json: one entry per game (opponent, net_color, result +1/-1, margin = net's area score minus the opponent's incl. komi, end, stones captured / lost, moves: ply, by, move (row*9+col, 81 = pass), and for the network's moves its top-5 [move, probability]). boards.npy: (games, 162, 81) int8, the board AFTER each ply (1 Black, -1 White, 0 empty; index row*9+col); valid.npy: (games, 162) which plies were played."}import json,numpy as np,collectionsg=json.load(open('/work/pass_5/games.json')); boards=np.load('/work/pass_5/boards.npy')adj=[[j for j in (q-9,q+9,q-1,q+1) if 0<=j<81 and abs(j//9-q//9)+abs(j%9-q%9)==1] for q in range(81)]def group_info(b): info={} for q in range(81): if b[q]==0 or q in info:continue stack=[q];ss={q};ll=set() while stack: t=stack.pop() for v in adj[t]: if b[v]==0:ll.add(v) elif b[v]==b[q] and v not in ss:ss.add(v);stack.append(v) for t in ss:info[t]=(ss,ll) return infodef show(b): return '\n'.join(''.join({0:'.',1:'X',-1:'O'}[int(v)] for v in row) for row in np.asarray(b).reshape(9,9))stats=collections.Counter();bad=[]for gi,x in enumerate(g): if x['opponent']!='strong':continue if x['result']<0: print('LOSS',gi,x['net_color'],x['margin'],x['end'],x['stones_lost_by_net']) color=1 if x['net_color']=='black' else -1 for pi,m in enumerate(x['moves']): if m['by']!='net' or m['move']==81:continue before=np.zeros(81,np.int8) if pi==0 else boards[gi,pi-1] after=boards[gi,pi];gr=group_info(before);q=m['move'] caps=sum(before==-color)-sum(after==-color) grp,libs=group_info(after)[q] stats['moves']+=1 if len(libs)==1: stats['self_atari']+=1 if caps==0: stats['noncapture_self_atari']+=1 if len(grp)>=3:bad.append((gi,pi,q,len(grp),x['result'],m['top5']))print(stats)print('Large group self-ataris:',bad[:12])for gi,pi,q,n,res,top in bad[:3]: print('\n',gi,pi,q,n,res,top) print(show(boards[gi,pi-1]))loss=[i for i,x in enumerate(g) if x['opponent']=='strong' and x['result']<0]for gi in loss[:2]: print('\nGAME',gi) x=g[gi] for pi,m in enumerate(x['moves']): if pi<34 and m['by']=='net':print(pi,m['move'],m['top5'][:3]) if pi in [15,31,47,len(x['moves'])-1]:print('after',pi,'\n'+show(boards[gi,pi]))LOSS 19 black -33.5 two passes 63LOSS 24 black -18.5 two passes 30LOSS 29 black -10.5 two passes 15LOSS 32 black -14.5 two passes 9LOSS 35 black -18.5 two passes 23LOSS 38 black -17.5 two passes 11LOSS 43 black -4.5 two passes 18LOSS 44 black -26.5 two passes 33LOSS 47 black -21.5 two passes 18LOSS 55 black -6.5 two passes 12LOSS 60 white -3.5 two passes 13LOSS 67 white 19.5 repetition 12LOSS 72 white -7.5 two passes 22LOSS 74 white -3.5 two passes 70LOSS 91 white -5.5 two passes 19LOSS 96 white -0.5 two passes 19Counter({'moves': 5576, 'self_atari': 92, 'noncapture_self_atari': 62})Large group self-ataris: [(15, 62, 4, 10, 1, [[4, 1.0], [5, 0.0], [16, 0.0], [35, 0.0], [34, 0.0]]), (16, 66, 5, 3, 1, [[5, 0.8449], [11, 0.0597], [66, 0.0304], [3, 0.0225], [21, 0.0189]]), (17, 66, 4, 8, 1, [[4, 0.997], [70, 0.0017], [5, 0.001], [6, 0.0001], [76, 0.0]]), (24, 68, 6, 14, -1, [[6, 0.8687], [7, 0.1267], [9, 0.0034], [44, 0.0009], [35, 0.0001]]), (24, 76, 38, 4, -1, [[38, 0.9551], [32, 0.0449], [23, 0.0], [9, 0.0], [5, 0.0]]), (24, 80, 41, 6, -1, [[41, 0.964], [9, 0.0353], [72, 0.0006], [0, 0.0], [81, 0.0]]), (24, 88, 1, 3, -1, [[1, 0.7305], [81, 0.2687], [18, 0.0007], [73, 0.0], [68, 0.0]]), (29, 92, 60, 3, -1, [[60, 1.0], [67, 0.0], [81, 0.0], [66, 0.0], [32, 0.0]]), (43, 96, 11, 3, -1, [[11, 0.9995], [20, 0.0005], [29, 0.0], [81, 0.0], [1, 0.0]]), (44, 86, 18, 3, -1, [[1, 0.5685], [81, 0.2686], [18, 0.1629], [77, 0.0], [12, 0.0]]), (47, 74, 70, 3, -1, [[70, 1.0], [52, 0.0], [21, 0.0], [20, 0.0], [81, 0.0]]), (55, 62, 77, 4, -1, [[77, 1.0], [10, 0.0], [22, 0.0], [78, 0.0], [71, 0.0]])]
15 62 4 10 1 [[4, 1.0], [5, 0.0], [16, 0.0], [35, 0.0], [34, 0.0]]..OX......O.OXXO...OOXXOO..OXOOXO...XXOXXXOOO.XOOOOXOXX.XXOXXXX.XX.XOOO.X.XXXX.O.
16 66 5 3 1 [[5, 0.8449], [11, 0.0597], [66, 0.0304], [3, 0.0225], [21, 0.0189]]....O.......XOXXOOOOX.XOOOOXX...XXOX.XXXXX.XXX.X.X.X.X.XXX.X.X.X...XOX.X.....O.X.
17 66 4 8 1 [[4, 0.997], [70, 0.0017], [5, 0.001], [6, 0.0001], [76, 0.0]]..OO.....OOXXXXOO.XXXOOOOO.OOOOOXXXOOOXXXX.XXOXXX..XX.XX..XX.X..XXXXXX..X........
GAME 190 40 [[40, 1.0], [31, 0.0], [39, 0.0]]2 31 [[31, 0.4207], [39, 0.2552], [41, 0.2552]]4 41 [[39, 0.2916], [41, 0.2916], [30, 0.1191]]6 59 [[59, 0.4843], [32, 0.4274], [42, 0.0486]]8 39 [[39, 0.4056], [57, 0.3433], [32, 0.2006]]10 32 [[57, 0.9449], [51, 0.0222], [32, 0.0149]]12 33 [[60, 0.3643], [33, 0.3422], [57, 0.2352]]14 60 [[60, 0.7843], [30, 0.1397], [38, 0.0387]]after 15 ...............................XXX.....XXXO....OOOOOO.....OXX....................16 38 [[30, 0.6543], [38, 0.189], [57, 0.1338]]18 61 [[57, 0.5929], [61, 0.2237], [34, 0.1786]]20 57 [[57, 0.99], [30, 0.005], [29, 0.0015]]22 66 [[66, 0.9972], [67, 0.0028], [30, 0.0]]24 67 [[67, 0.9997], [65, 0.0002], [69, 0.0001]]26 69 [[69, 0.9768], [30, 0.0085], [29, 0.0053]]28 77 [[77, 1.0], [70, 0.0], [25, 0.0]]30 30 [[30, 0.8754], [25, 0.0419], [70, 0.0418]]after 31 ........................O....OXXXXO..OXXXXOO...OOOOOO...OXOXXX...OXX.X.......X...32 70 [[46, 0.288], [70, 0.2329], [25, 0.2215]]after 47 ..OX.......OXO.....OXXO.O...OOXXXXO..OXXXXOO..OOOOOOO..XOXOXXX.OXOXX.XX...X..X...after 109 .OOOOOOOOOO.OOOOOOOOOOOOOOO.OO.OX.OOXOO.O.OOOXOOOOOOO.XXOXOXXXO.XOXX.XXXX.XX.X.X.
GAME 240 40 [[40, 1.0], [31, 0.0], [39, 0.0]]2 31 [[31, 0.4207], [39, 0.2552], [41, 0.2552]]4 41 [[39, 0.2916], [41, 0.2916], [30, 0.1191]]6 59 [[59, 0.4843], [32, 0.4274], [42, 0.0486]]8 39 [[39, 0.4056], [57, 0.3433], [32, 0.2006]]10 57 [[57, 0.9449], [51, 0.0222], [32, 0.0149]]12 38 [[38, 0.4378], [56, 0.178], [51, 0.1513]]14 66 [[66, 0.4999], [51, 0.4676], [67, 0.0325]]after 15 ...............................X......XXXXO....OOOOO....OXOX......X..............16 60 [[60, 0.9734], [67, 0.0103], [32, 0.0103]]18 67 [[67, 0.9997], [32, 0.0002], [65, 0.0001]]20 65 [[69, 0.5262], [65, 0.4098], [32, 0.0288]]22 69 [[69, 0.8477], [32, 0.0451], [37, 0.0376]]24 77 [[77, 1.0], [37, 0.0], [32, 0.0]]26 32 [[37, 0.3987], [32, 0.2645], [30, 0.1959]]28 30 [[30, 0.8601], [37, 0.089], [43, 0.018]]30 55 [[55, 0.7926], [21, 0.1196], [28, 0.0497]]after 31 ....................O.O......OXXXO...OXXXXO...OOOOOOO..XOXOXX....XXX.X.......X...32 23 [[23, 1.0], [64, 0.0], [28, 0.0]]after 47 ....X.......XOXX...OOOOXOO.XXOXXXOO..OXXXXO...OOOOOOO.OXOXOXX...XXXX.X...O...X...after 90 XXOOO.OO.XO.OOO..O.OOOO.OO.XXOXXXOOOOOXXOXOO.OOOOOOOOOOXOXOXXXOXXXXX.XXXX.XX.X.X.import jsonsrc=open('/work/design_v5.py').read()src=src.replace("capture_guard=0.)", "capture_guard=0., support_adj=1.25, support_dist2=.75, support_dist3=.3125)")src=src.replace("w(5,u(0,t),I,-1.25*iw)","""support={1:p['support_adj'],2:p['support_dist2'],3:p['support_dist3']}.get(d,0.) w(5,u(0,t),I,-support)""")open('/work/design_v6.py','w').write(src)exec(src)cfg=json.load(open('/work/config_v5.json'))cfg.update(support_adj=2.5,support_dist2=.35,support_dist3=.1,isolation_threshold=1.8)config=install(cfg)json.dump(config,open('/work/config_v6.json','w'),indent=2)print(config){'capture': 11.0, 'capture_extra': 3.0, 'save': 7.0, 'danger': 10.0, 'eye': 22.0, 'isolation': 3.0, 'isolation_threshold': 1.8, 'base': 1.3, 'pass_bias': -1.0, 'attack': 1.3, 'own_adj': 2.0, 'opp_adj': 1.5, 'opening': 3.0, 'save_danger': 2.0, 'safe2': 1.0, 'safe3': 1.0, 'cap_safety': 1.0, 'crowd': 3.0, 'temperature_scale': 2.5, 'defend': 1.0, 'first_center': 20.0, 'triangle': 1.5, 'capture_guard': 0.2, 'support_adj': 2.5, 'support_dist2': 0.35, 'support_dist3': 0.1}{"games":{"strong":96,"weak":24,"random":8}}{"ok": true, "pass": 6, "kind": "games", "per_opponent": {"random": {"games": 8, "score": 1.0, "wins": 8, "losses": 0, "score_as_black": 1.0, "score_as_white": 1.0, "mean_margin": 50.25, "mean_length": 106.25, "stones_captured_per_game": 56.25, "stones_lost_per_game": 0.0, "passes_per_game": 1.75, "games_with_a_pass_before_move_60": 0, "end_two_passes": 8, "end_repetition": 0, "end_move_limit": 0}, "strong": {"games": 96, "score": 0.65625, "wins": 63, "losses": 33, "score_as_black": 0.6041666865348816, "score_as_white": 0.7083333134651184, "mean_margin": 43.78125, "mean_length": 113.80208333333333, "stones_captured_per_game": 63.208333333333336, "stones_lost_per_game": 8.260416666666666, "passes_per_game": 3.3958333333333335, "games_with_a_pass_before_move_60": 0, "end_two_passes": 94, "end_repetition": 0, "end_move_limit": 2}, "weak": {"games": 24, "score": 0.9166666865348816, "wins": 22, "losses": 2, "score_as_black": 0.9166666865348816, "score_as_white": 0.9166666865348816, "mean_margin": 71.625, "mean_length": 123.25, "stones_captured_per_game": 85.625, "stones_lost_per_game": 2.9583333333333335, "passes_per_game": 3.2916666666666665, "games_with_a_pass_before_move_60": 0, "end_two_passes": 23, "end_repetition": 1, "end_move_limit": 0}}, "files": "/work/pass_6/", "readme": "games.json: one entry per game (opponent, net_color, result +1/-1, margin = net's area score minus the opponent's incl. komi, end, stones captured / lost, moves: ply, by, move (row*9+col, 81 = pass), and for the network's moves its top-5 [move, probability]). boards.npy: (games, 162, 81) int8, the board AFTER each ply (1 Black, -1 White, 0 empty; index row*9+col); valid.npy: (games, 162) which plies were played."}import jsonsrc=open('/work/design_v6.py').read()src=src.replace("support_dist3=.3125)","support_dist3=.3125, safety_threshold=2.)")src=src.replace("b(5,D,2-len(adj[q]))","b(5,D,p['safety_threshold']-len(adj[q]))")open('/work/design_v7.py','w').write(src)exec(src)cfg=json.load(open('/work/config_v5.json'))cfg.update(temperature_scale=3.5,safety_threshold=1.7,safe2=.7,safe3=1.3, cap_safety=.85,danger=14.)config=install(cfg)json.dump(config,open('/work/config_v7.json','w'),indent=2)print(config){'capture': 11.0, 'capture_extra': 3.0, 'save': 7.0, 'danger': 14.0, 'eye': 22.0, 'isolation': 3.0, 'isolation_threshold': 2.5, 'base': 1.3, 'pass_bias': -1.0, 'attack': 1.3, 'own_adj': 2.0, 'opp_adj': 1.5, 'opening': 3.0, 'save_danger': 2.0, 'safe2': 0.7, 'safe3': 1.3, 'cap_safety': 0.85, 'crowd': 3.0, 'temperature_scale': 3.5, 'defend': 1.0, 'first_center': 20.0, 'triangle': 1.5, 'capture_guard': 0.2, 'support_adj': 1.25, 'support_dist2': 0.75, 'support_dist3': 0.3125, 'safety_threshold': 1.7}{"games":{"strong":96,"weak":24,"random":8}}{"ok": true, "pass": 7, "kind": "games", "per_opponent": {"random": {"games": 8, "score": 1.0, "wins": 8, "losses": 0, "score_as_black": 1.0, "score_as_white": 1.0, "mean_margin": 68.5, "mean_length": 114.125, "stones_captured_per_game": 65.125, "stones_lost_per_game": 0.625, "passes_per_game": 1.125, "games_with_a_pass_before_move_60": 0, "end_two_passes": 8, "end_repetition": 0, "end_move_limit": 0}, "strong": {"games": 96, "score": 0.78125, "wins": 75, "losses": 21, "score_as_black": 0.7291666865348816, "score_as_white": 0.8333333134651184, "mean_margin": 55.02083206176758, "mean_length": 115.77083333333333, "stones_captured_per_game": 64.42708333333333, "stones_lost_per_game": 7.177083333333333, "passes_per_game": 1.9895833333333333, "games_with_a_pass_before_move_60": 0, "end_two_passes": 92, "end_repetition": 2, "end_move_limit": 2}, "weak": {"games": 24, "score": 0.9583333134651184, "wins": 23, "losses": 1, "score_as_black": 0.9166666865348816, "score_as_white": 1.0, "mean_margin": 72.83333587646484, "mean_length": 123.41666666666667, "stones_captured_per_game": 87.95833333333333, "stones_lost_per_game": 2.3333333333333335, "passes_per_game": 2.9166666666666665, "games_with_a_pass_before_move_60": 0, "end_two_passes": 24, "end_repetition": 0, "end_move_limit": 0}}, "files": "/work/pass_7/", "readme": "games.json: one entry per game (opponent, net_color, result +1/-1, margin = net's area score minus the opponent's incl. komi, end, stones captured / lost, moves: ply, by, move (row*9+col, 81 = pass), and for the network's moves its top-5 [move, probability]). boards.npy: (games, 162, 81) int8, the board AFTER each ply (1 Black, -1 White, 0 empty; index row*9+col); valid.npy: (games, 162) which plies were played."}import jsonsrc=open('/work/design_v7.py').read()src=src.replace("safety_threshold=2.)", "safety_threshold=2., pass_deficit=0., deficit_cap=16.)")src=src.replace("""b(1,487,1) for q in range(81): w(1,3*q,487,-1) w(1,3*q+1,487,-1)""","w(1,2,487,1)")src=src.replace("if q==40: w(5,487,P,p['first_center'])","# Empty-board opening bonus is applied in layer 6.")src=src.replace(" line=[-1.2",''' # Reconstruct the empty-board flag after the positional phase signal. w(5,486,486,30); b(5,486,-29) # A conservative late-game score proxy, used only to discourage # resignation-by-passing while apparently behind. b(5,487,7.5) w(5,487,487,-15) for t in range(81): w(5,u(1,t),487,1) w(5,u(0,t),487,-1) w(6,487,487,1) w(6,487,488,1); b(6,488,-p['deficit_cap']) line=[-1.2''')src=src.replace("w(6,P,u(5,q),1)","""w(6,P,u(5,q),1) if q==40: w(6,486,u(5,q),p['first_center'])""")src=src.replace("a['out.b'][81]=p['pass_bias']","""a['out.b'][81]=p['pass_bias'] a['out.W'][487,81]=-p['pass_deficit'] a['out.W'][488,81]=p['pass_deficit']""")open('/work/design_v8.py','w').write(src)exec(src)cfg=json.load(open('/work/config_v5.json'))cfg.update(pass_deficit=.5,deficit_cap=16.)config=install(cfg)json.dump(config,open('/work/config_v8.json','w'),indent=2)print(config){'capture': 11.0, 'capture_extra': 3.0, 'save': 7.0, 'danger': 10.0, 'eye': 22.0, 'isolation': 3.0, 'isolation_threshold': 2.5, 'base': 1.3, 'pass_bias': -1.0, 'attack': 1.3, 'own_adj': 2.0, 'opp_adj': 1.5, 'opening': 3.0, 'save_danger': 2.0, 'safe2': 1.0, 'safe3': 1.0, 'cap_safety': 1.0, 'crowd': 3.0, 'temperature_scale': 2.5, 'defend': 1.0, 'first_center': 20.0, 'triangle': 1.5, 'capture_guard': 0.2, 'support_adj': 1.25, 'support_dist2': 0.75, 'support_dist3': 0.3125, 'safety_threshold': 2.0, 'pass_deficit': 0.5, 'deficit_cap': 16.0}{"games":{"strong":96,"weak":24,"random":8}}{"ok": true, "pass": 8, "kind": "games", "per_opponent": {"random": {"games": 8, "score": 1.0, "wins": 8, "losses": 0, "score_as_black": 1.0, "score_as_white": 1.0, "mean_margin": 75.5, "mean_length": 117.75, "stones_captured_per_game": 74.5, "stones_lost_per_game": 0.375, "passes_per_game": 1.25, "games_with_a_pass_before_move_60": 0, "end_two_passes": 8, "end_repetition": 0, "end_move_limit": 0}, "strong": {"games": 96, "score": 0.78125, "wins": 75, "losses": 21, "score_as_black": 0.7291666865348816, "score_as_white": 0.8333333134651184, "mean_margin": 55.89583206176758, "mean_length": 121.42708333333333, "stones_captured_per_game": 76.9375, "stones_lost_per_game": 9.270833333333334, "passes_per_game": 2.2083333333333335, "games_with_a_pass_before_move_60": 0, "end_two_passes": 94, "end_repetition": 0, "end_move_limit": 2}, "weak": {"games": 24, "score": 1.0, "wins": 24, "losses": 0, "score_as_black": 1.0, "score_as_white": 1.0, "mean_margin": 78.33333587646484, "mean_length": 129.54166666666666, "stones_captured_per_game": 91.08333333333333, "stones_lost_per_game": 3.1666666666666665, "passes_per_game": 3.125, "games_with_a_pass_before_move_60": 0, "end_two_passes": 24, "end_repetition": 0, "end_move_limit": 0}}, "files": "/work/pass_8/", "readme": "games.json: one entry per game (opponent, net_color, result +1/-1, margin = net's area score minus the opponent's incl. komi, end, stones captured / lost, moves: ply, by, move (row*9+col, 81 = pass), and for the network's moves its top-5 [move, probability]). boards.npy: (games, 162, 81) int8, the board AFTER each ply (1 Black, -1 White, 0 empty; index row*9+col); valid.npy: (games, 162) which plies were played."}import jsonexec(open('/work/design_v8.py').read())cfg=json.load(open('/work/config_v5.json'))cfg['temperature_scale']=4.config=install(cfg)json.dump(config,open('/work/config_v9.json','w'),indent=2)print('Installed the established tactical/shape design with sharper move selection.')print(config)Installed the established tactical/shape design with sharper move selection.{'capture': 11.0, 'capture_extra': 3.0, 'save': 7.0, 'danger': 10.0, 'eye': 22.0, 'isolation': 3.0, 'isolation_threshold': 2.5, 'base': 1.3, 'pass_bias': -1.0, 'attack': 1.3, 'own_adj': 2.0, 'opp_adj': 1.5, 'opening': 3.0, 'save_danger': 2.0, 'safe2': 1.0, 'safe3': 1.0, 'cap_safety': 1.0, 'crowd': 3.0, 'temperature_scale': 4.0, 'defend': 1.0, 'first_center': 20.0, 'triangle': 1.5, 'capture_guard': 0.2, 'support_adj': 1.25, 'support_dist2': 0.75, 'support_dist3': 0.3125, 'safety_threshold': 2.0, 'pass_deficit': 0.0, 'deficit_cap': 16.0}{"games":{"strong":96,"weak":24,"random":8}}{"ok": true, "pass": 9, "kind": "games", "per_opponent": {"random": {"games": 8, "score": 1.0, "wins": 8, "losses": 0, "score_as_black": 1.0, "score_as_white": 1.0, "mean_margin": 65.75, "mean_length": 113.625, "stones_captured_per_game": 69.875, "stones_lost_per_game": 0.375, "passes_per_game": 1.0, "games_with_a_pass_before_move_60": 0, "end_two_passes": 8, "end_repetition": 0, "end_move_limit": 0}, "strong": {"games": 96, "score": 0.7916666865348816, "wins": 76, "losses": 20, "score_as_black": 0.7083333134651184, "score_as_white": 0.875, "mean_margin": 55.47916793823242, "mean_length": 118.34375, "stones_captured_per_game": 71.58333333333333, "stones_lost_per_game": 8.447916666666666, "passes_per_game": 2.3020833333333335, "games_with_a_pass_before_move_60": 0, "end_two_passes": 94, "end_repetition": 0, "end_move_limit": 2}, "weak": {"games": 24, "score": 0.8333333134651184, "wins": 20, "losses": 4, "score_as_black": 0.75, "score_as_white": 0.9166666865348816, "mean_margin": 67.95833587646484, "mean_length": 122.45833333333333, "stones_captured_per_game": 76.5, "stones_lost_per_game": 4.416666666666667, "passes_per_game": 2.625, "games_with_a_pass_before_move_60": 0, "end_two_passes": 23, "end_repetition": 1, "end_move_limit": 0}}, "files": "/work/pass_9/", "readme": "games.json: one entry per game (opponent, net_color, result +1/-1, margin = net's area score minus the opponent's incl. komi, end, stones captured / lost, moves: ply, by, move (row*9+col, 81 = pass), and for the network's moves its top-5 [move, probability]). boards.npy: (games, 162, 81) int8, the board AFTER each ply (1 Black, -1 White, 0 empty; index row*9+col); valid.npy: (games, 162) which plies were played."}import json, numpy as npexec(open('/work/design_v5.py').read())final_config=json.load(open('/work/config_v5.json'))install(final_config)for name in NAMES: value=load(name) assert value.shape==tuple(SHAPES[name]) assert value.dtype==np.float32 assert np.isfinite(value).all()assert set(saved())==set(NAMES)json.dump(final_config,open('/work/final_config.json','w'),indent=2)print('Final policy saved and all 14 tensors checked.')print('Design: liberty-based group signals, guarded captures, atari escapes,')print('self-atari avoidance, eye preservation, connection/shape preferences,')print('local influence, center opening, and conservative passing.')print('No training, search, or sandbox forward evaluations were used.')Final policy saved and all 14 tensors checked.Design: liberty-based group signals, guarded captures, atari escapes,self-atari avoidance, eye preservation, connection/shape preferences,local influence, center opening, and conservative passing.No training, search, or sandbox forward evaluations were used.{"games":{"strong":96,"weak":24,"random":8}}{"ok": true, "pass": 10, "kind": "games", "per_opponent": {"random": {"games": 8, "score": 1.0, "wins": 8, "losses": 0, "score_as_black": 1.0, "score_as_white": 1.0, "mean_margin": 73.75, "mean_length": 122.25, "stones_captured_per_game": 93.75, "stones_lost_per_game": 0.375, "passes_per_game": 1.25, "games_with_a_pass_before_move_60": 0, "end_two_passes": 8, "end_repetition": 0, "end_move_limit": 0}, "strong": {"games": 96, "score": 0.7604166865348816, "wins": 73, "losses": 23, "score_as_black": 0.7083333134651184, "score_as_white": 0.8125, "mean_margin": 50.72916793823242, "mean_length": 118.03125, "stones_captured_per_game": 68.20833333333333, "stones_lost_per_game": 9.875, "passes_per_game": 2.375, "games_with_a_pass_before_move_60": 0, "end_two_passes": 92, "end_repetition": 1, "end_move_limit": 3}, "weak": {"games": 24, "score": 0.9166666865348816, "wins": 22, "losses": 2, "score_as_black": 0.9166666865348816, "score_as_white": 0.9166666865348816, "mean_margin": 73.45833587646484, "mean_length": 123.58333333333333, "stones_captured_per_game": 84.33333333333333, "stones_lost_per_game": 3.4166666666666665, "passes_per_game": 2.2916666666666665, "games_with_a_pass_before_move_60": 0, "end_two_passes": 24, "end_repetition": 0, "end_move_limit": 0}}, "files": "/work/pass_10/", "readme": "games.json: one entry per game (opponent, net_color, result +1/-1, margin = net's area score minus the opponent's incl. komi, end, stones captured / lost, moves: ply, by, move (row*9+col, 81 = pass), and for the network's moves its top-5 [move, probability]). boards.npy: (games, 162, 81) int8, the board AFTER each ply (1 Black, -1 White, 0 empty; index row*9+col); valid.npy: (games, 162) which plies were played."}