commit 7a1ae39aded3024d970cf1b6c56429dd20e629e8
parent 2e5337dea4c58ebc6f5fba874ecefcd99c8c3fad
Author: mpizzzle <m@michaelpercival.xyz>
Date: Tue, 6 Sep 2022 00:43:45 +0100
adding new article, besogo library with minimal css
Diffstat:
7 files changed, 841 insertions(+), 0 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -1,5 +1,6 @@
.hugo_build.lock
public/
+assets/wallpapers/
static/wallpapers/
static/BQN386/
themes/
diff --git a/content/thoughts/getting-back-on-the-go.md b/content/thoughts/getting-back-on-the-go.md
@@ -0,0 +1,27 @@
+---
+title: "Getting back on the Go"
+date: 2022-09-06T20:45:16+01:00
+draft: false
+---
+
+_Creativity_, in the sense of creating new 'works' (music, poetry, blog posts etc...) takes a certain conscious appreciation that doesn't come around too often for me outside of computer programming.
+
+To get around this, I've been forcing myself to write a stream of consciousness every morning, pen to paper for a solid [twenty-five minutes](https://en.wikipedia.org/wiki/Pomodoro_Technique) to flex this under-developed muscle. Anything that's on my mind, be it dreams (literally and figuratively), goals, insecurities, etc... to help draw out my intention for the day. And maybe, on occasion, there will be a diamond in the roughest rough; that is to say original metaphors, similes and the like that can be distilled into pure poetry (or [bathos](https://en.wikipedia.org/wiki/Bathos)).
+
+I want to be promoting more of these creative tendencies in my life, so I'm going to try and write more articles about my thoughts and endeavours.
+For example, I've started playing a bit of [Go](https://en.wikipedia.org/wiki/Go_(game)) again;
+hopefully, writing about my terrible Go playing will force me to play with a little more intention.
+
+{{< besogo sgf="ai-sensei_20200506_mpizzzle_vs_kouchan2.sgf" >}}
+
+The above board is being rendered by [besogo](https://github.com/yewang/besogo), a lightweight sgf viewer written in javascript. It's easy to compile, although the recommended build instructions involve using the remote [Google Closure Compiler](https://closure-compiler.appspot.com/home) which it turns out has since been deprecated.
+
+The the offline [closure compiler](https://github.com/google/closure-compiler) can instead be used in the same way with the following one liner:
+
+{{< highlight javascript "linenos=true, style=dracula" >}}
+closure-compiler --compilation_level=SIMPLE --js js/* > besogo.min.js
+{{< /highlight >}}
+
+The above game was played back in 2020 on Pandanet, which was the last time I played internet Go in any consistent capacity. I uploaded the game to [ai-sensei](https://ai-sensei.com), which generates an sgf with depth 50 playout (4 moves) on any 10 kyu level 'mistake'; oh boy, there are a lot of mistakes...
+
+In terms of articles, if I end up adding a lot of Go content I'll add a separate rolling section, but for now I'm fine having all articles under 'Thoughts' until it becomes cumbersome to manage this way.
diff --git a/layouts/shortcodes/besogo.html b/layouts/shortcodes/besogo.html
@@ -0,0 +1,7 @@
+<div>
+ <link rel="stylesheet" type="text/css" href="/besogo/css/besogo.css">
+ <link rel="stylesheet" type="text/css" href="/besogo/css/board-flat.css" id="theme">
+ <script src="/besogo/besogo.min.js"></script>
+ <div class="besogo-viewer" panels="control+names+comment+tree" sgf="{{ .Site.BaseURL }}/baduk/{{ .Get "sgf" }}"/>
+ <script type="text/javascript">besogo.autoInit();</script>
+</div>
diff --git a/static/baduk/ai-sensei_20200506_mpizzzle_vs_kouchan2.sgf b/static/baduk/ai-sensei_20200506_mpizzzle_vs_kouchan2.sgf
@@ -0,0 +1,552 @@
+(;GM[1]FF[4]SZ[19]
+AP[ai-sensei.com]
+CA[UTF-8]ST[2]
+KM[6.5]RU[japanese]
+EV[Internet Go Server game: kouchan2 vs mpizzzle]DT[2020-05-06]
+PW[kouchan2]WR[10k+]
+PB[mpizzzle]BR[10k+]
+RE[B+33.5]
+C[Mistakes:
+
+Player Move Loss Score
+
+Black 51 8.2 W+20.4 points
+White 62 8.3 W+10.5 points
+White 72 9.7 W+12.4 points
+Black 73 11.9 W+24.3 points
+White 76 10.9 W+15.2 points
+White 88 11.7 W+5 points
+White 90 10.5 B+5.6 points
+Black 99 12.6 B+10.1 points
+Black 101 10.5 B+1.3 points
+White 102 9.4 B+10.7 points
+Black 103 10.2 B+0.5 points
+White 104 8.9 B+9.4 points
+Black 105 9.2 B+0.2 points
+White 106 8.8 B+9.0 points
+Black 107 10.6 W+1.6 points
+White 110 8.2 B+6.0 points
+Black 111 12.7 W+6.7 points
+White 118 16.4 B+9.0 points
+Black 119 11.3 W+2.3 points
+White 120 10.3 B+8.0 points
+White 128 7.9 B+4.7 points
+Black 133 10.8 W+6.5 points
+White 134 8.7 B+2.2 points
+White 136 8.1 B+2.8 points
+White 138 8.8 B+5.3 points
+Black 147 12.5 W+9.5 points
+White 148 16.1 B+6.6 points
+Black 149 16.9 W+10.3 points
+White 150 23.1 B+12.8 points
+Black 151 13.7 W+0.9 points
+White 152 20.9 B+20.0 points
+White 164 8.9 B+35.2 points
+Black 165 15.5 B+19.7 points
+White 166 16.2 B+35.9 points
+Black 167 13.3 B+22.6 points
+White 174 8.2 B+32.7 points
+Black 175 12.5 B+20.2 points
+White 176 9.7 B+29.9 points
+Black 177 19.7 B+10.2 points
+Black 179 13.4 W+1.7 points
+White 182 13.4 B+15.7 points
+Black 183 10.2 B+5.5 points
+Black 185 21.7 W+15 points
+White 186 29.0 B+14.0 points
+Black 187 10.1 B+3.9 points
+White 188 29.6 B+33.5 points
+White 196 10.1 B+42.3 points
+Black 197 9.6 B+32.7 points
+White 200 10.0 B+42.8 points
+Black 201 10.2 B+32.6 points
+White 202 10.0 B+42.6 points
+Black 203 9.3 B+33.3 points
+White 204 9.0 B+42.3 points
+Black 205 10.9 B+31.4 points
+White 214 8.2 B+43.2 points
+Black 215 9.0 B+34.2 points
+White 224 27.2 B+62.5 points
+Black 225 24.2 B+38.3 points
+White 226 24.3 B+62.6 points
+Black 227 31.5 B+31.1 points];B[pd];W[dp];B[pq];W[cd];B[qn];W[fd];B[fq];W[eq];B[fp];W[dm];B[jq];W[lq];B[lp];W[kq];B[kp];W[jr];B[iq];W[ir];B[hr];W[or];B[mq];W[mr];B[lr];W[kr];B[nr];W[ls];B[nq];W[ns];B[pr];W[ql];B[qj];W[qp];B[rn];W[mp];B[np];W[jp];B[ip];W[jo];B[kn];W[mo];B[ln];W[mn];B[mm];W[on];B[nn];W[no];B[oo];W[nm];B[po];W[ml]
+(;B[pm]C[Mistake!
+
+This move is 8.2 points worse than the AI move.
+
+White is ahead by 20.4 points.];W[pl];B[ol];W[ok];B[om];W[pk];B[qg];W[nl];B[im];W[io];B[ho]
+(;W[hp]C[Mistake!
+
+This move is 8.3 points worse than the AI move.
+
+White is ahead by 10.5 points.];B[hq];W[hn];B[go];W[in];B[hm];W[gn];B[fn];W[gm];B[gl]
+(;W[jm]C[Mistake!
+
+This move is 9.7 points worse than the AI move.
+
+White is ahead by 12.4 points.]
+(;B[jn]C[Mistake!
+
+This move is 11.9 points worse than the AI move.
+
+White is ahead by 24.3 points.];W[fm];B[jl]
+(;W[km]C[Mistake!
+
+This move is 10.9 points worse than the AI move.
+
+White is ahead by 15.2 points.];B[lm];W[kl];B[ll];W[kk];B[lk];W[lj];B[kj];W[jk];B[mj];W[li];B[lo]
+(;W[nk]C[Mistake!
+
+This move is 11.7 points worse than the AI move.
+
+White is ahead by 5.0 points.];B[nn]
+(;W[mk]C[Mistake!
+
+This move is 10.5 points worse than the AI move.
+
+Black is ahead by 5.6 points.];B[mi];W[nh];B[mh];W[og];B[mf];W[lh];B[lg];W[ji]
+(;B[kh]C[Mistake!
+
+This move is 12.6 points worse than the AI move.
+
+Black is ahead by 10.1 points.];W[ki]
+(;B[id]C[Mistake!
+
+This move is 10.5 points worse than the AI move.
+
+Black is ahead by 1.3 points.]
+(;W[if]C[Mistake!
+
+This move is 9.4 points worse than the AI move.
+
+Black is ahead by 10.7 points.]
+(;B[ck]C[Mistake!
+
+This move is 10.2 points worse than the AI move.
+
+Black is ahead by 0.5 points.]
+(;W[ci]C[Mistake!
+
+This move is 8.9 points worse than the AI move.
+
+Black is ahead by 9.4 points.]
+(;B[ek]C[Mistake!
+
+This move is 9.2 points worse than the AI move.
+
+Black is ahead by 0.2 points.]
+(;W[dj]C[Mistake!
+
+This move is 8.8 points worse than the AI move.
+
+Black is ahead by 9.0 points.]
+(;B[bm]C[Mistake!
+
+This move is 10.6 points worse than the AI move.
+
+White is ahead by 1.6 points.];W[dk];B[co]
+(;W[do]C[Mistake!
+
+This move is 8.2 points worse than the AI move.
+
+Black is ahead by 6.0 points.]
+(;B[cn]C[Mistake!
+
+This move is 12.7 points worse than the AI move.
+
+White is ahead by 6.7 points.];W[en];B[cq];W[cp];B[bp];W[cr];B[br]
+(;W[fo]C[Mistake!
+
+This move is 16.4 points worse than the AI move.
+
+Black is ahead by 9.0 points.]
+(;B[gp]C[Mistake!
+
+This move is 11.3 points worse than the AI move.
+
+White is ahead by 2.3 points.]
+(;W[dr]C[Mistake!
+
+This move is 10.3 points worse than the AI move.
+
+Black is ahead by 8.0 points.];B[nc];W[gr];B[gc];W[gd];B[hd];W[fc];B[he]
+(;W[gf]C[Mistake!
+
+This move is 7.9 points worse than the AI move.
+
+Black is ahead by 4.7 points.];B[hf];W[hg];B[gb];W[fb]
+(;B[fa]C[Mistake!
+
+This move is 10.8 points worse than the AI move.
+
+White is ahead by 6.5 points.]
+(;W[ea]C[Mistake!
+
+This move is 8.7 points worse than the AI move.
+
+Black is ahead by 2.2 points.];B[ga]
+(;W[db]C[Mistake!
+
+This move is 8.1 points worse than the AI move.
+
+Black is ahead by 2.8 points.];B[ge]
+(;W[fe]C[Mistake!
+
+This move is 8.8 points worse than the AI move.
+
+Black is ahead by 5.3 points.];B[gg];W[ff];B[ig];W[hh];B[jg];W[qf];B[rf];W[qe]
+(;B[rk]C[Mistake!
+
+This move is 12.5 points worse than the AI move.
+
+White is ahead by 9.5 points.]
+(;W[qm]C[Mistake!
+
+This move is 16.1 points worse than the AI move.
+
+Black is ahead by 6.6 points.]
+(;B[pn]C[Mistake!
+
+This move is 16.9 points worse than the AI move.
+
+White is ahead by 10.3 points.]
+(;W[rl]C[Mistake!
+
+This move is 23.1 points worse than the AI move.
+
+Black is ahead by 12.8 points.]
+(;B[pg]C[Mistake!
+
+This move is 13.7 points worse than the AI move.
+
+White is ahead by 0.9 points.]
+(;W[pf]C[Mistake!
+
+This move is 20.9 points worse than the AI move.
+
+Black is ahead by 20.0 points.];B[re];W[qd];B[qc];W[rc];B[qb];W[rd];B[rh];W[oe];B[oi];W[ni];B[nf]
+(;W[of]C[Mistake!
+
+This move is 8.9 points worse than the AI move.
+
+Black is ahead by 35.2 points.]
+(;B[pi]C[Mistake!
+
+This move is 15.5 points worse than the AI move.
+
+Black is ahead by 19.7 points.]
+(;W[sg]C[Mistake!
+
+This move is 16.2 points worse than the AI move.
+
+Black is ahead by 35.9 points.]
+(;B[sh]C[Mistake!
+
+This move is 13.3 points worse than the AI move.
+
+Black is ahead by 22.6 points.];W[nj];B[mg];W[jd];B[jc];W[kc];B[kd]
+(;W[ld]C[Mistake!
+
+This move is 8.2 points worse than the AI move.
+
+Black is ahead by 32.7 points.]
+(;B[md]C[Mistake!
+
+This move is 12.5 points worse than the AI move.
+
+Black is ahead by 20.2 points.]
+(;W[nd]C[Mistake!
+
+This move is 9.7 points worse than the AI move.
+
+Black is ahead by 29.9 points.]
+(;B[od]C[Mistake!
+
+This move is 19.7 points worse than the AI move.
+
+Black is ahead by 10.2 points.];W[ne]
+(;B[lc]C[Mistake!
+
+This move is 13.4 points worse than the AI move.
+
+White is ahead by 1.7 points.];W[ke];B[me]
+(;W[kf]C[Mistake!
+
+This move is 13.4 points worse than the AI move.
+
+Black is ahead by 15.7 points.]
+(;B[jf]C[Mistake!
+
+This move is 10.2 points worse than the AI move.
+
+Black is ahead by 5.5 points.];W[kg]
+(;B[jh]C[Mistake!
+
+This move is 21.7 points worse than the AI move.
+
+White is ahead by 15.0 points.]
+(;W[ii]C[Mistake!
+
+This move is 29 points worse than the AI move.
+
+Black is ahead by 14.0 points.]
+(;B[je]C[Mistake!
+
+This move is 10.1 points worse than the AI move.
+
+Black is ahead by 3.9 points.]
+(;W[kd]C[Mistake!
+
+This move is 29.6 points worse than the AI move.
+
+Black is ahead by 33.5 points.];B[jb];W[kb];B[lb];W[ih];B[ie];W[la];B[mb]
+(;W[rb]C[Mistake!
+
+This move is 10.1 points worse than the AI move.
+
+Black is ahead by 42.3 points.]
+(;B[ja]C[Mistake!
+
+This move is 9.6 points worse than the AI move.
+
+Black is ahead by 32.7 points.];W[pb];B[pc]
+(;W[qa]C[Mistake!
+
+This move is 10 points worse than the AI move.
+
+Black is ahead by 42.8 points.]
+(;B[ob]C[Mistake!
+
+This move is 10.2 points worse than the AI move.
+
+Black is ahead by 32.6 points.]
+(;W[pa]C[Mistake!
+
+This move is 10 points worse than the AI move.
+
+Black is ahead by 42.6 points.]
+(;B[oa]C[Mistake!
+
+This move is 9.3 points worse than the AI move.
+
+Black is ahead by 33.3 points.]
+(;W[ra]C[Mistake!
+
+This move is 9 points worse than the AI move.
+
+Black is ahead by 42.3 points.]
+(;B[ka]C[Mistake!
+
+This move is 10.9 points worse than the AI move.
+
+Black is ahead by 31.4 points.];W[pe];B[oc];W[se];B[rg];W[sd];B[sb];W[sk];B[sj]
+(;W[sf]C[Mistake!
+
+This move is 8.2 points worse than the AI move.
+
+Black is ahead by 43.2 points.]
+(;B[ri]C[Mistake!
+
+This move is 9 points worse than the AI move.
+
+Black is ahead by 34.2 points.];W[qk];B[rj];W[cl];B[bl];W[bk];B[bs];W[aq];B[bq]
+(;W[al]C[Mistake!
+
+This move is 27.2 points worse than the AI move.
+
+Black is ahead by 62.5 points.]
+(;B[am]C[Mistake!
+
+This move is 24.2 points worse than the AI move.
+
+Black is ahead by 38.3 points.]
+(;W[ak]C[Mistake!
+
+This move is 24.3 points worse than the AI move.
+
+Black is ahead by 62.6 points.]
+(;B[ep]C[Mistake!
+
+This move is 31.5 points worse than the AI move.
+
+Black is ahead by 31.1 points.];W[fr];B[dq];W[er];B[gs];W[gq];B[oq];W[os];B[ps];W[ms];B[dn];W[eo];B[cm];W[cj];B[cs];W[ds];B[];W[];B[])
+(;B[fr]C[I would play here.
+
+Black is ahead by 62.6 points.];W[hs];B[dq];W[er]))
+(;W[fr]C[I would play here.
+
+Black is ahead by 38.3 points.];B[bj];W[cj];B[ak];W[ps]))
+(;B[fr]C[I would play here.
+
+Black is ahead by 62.5 points.];W[hs];B[dq]))
+(;W[dq]C[I would play here.
+
+Black is ahead by 35.3 points.];B[ak];W[bj];B[cm]))
+(;B[fr]C[I would play here.
+
+Black is ahead by 43.2 points.];W[hs];B[bj];W[bi]))
+(;W[bk]C[I would play here.
+
+Black is ahead by 35.0 points.];B[cl];W[bj]))
+(;B[bq]C[I would play here.
+
+Black is ahead by 42.3 points.];W[fr];B[bj];W[bi]))
+(;W[cl]C[I would play here.
+
+Black is ahead by 33.3 points.];B[bl];W[bk];B[fr]))
+(;B[bq]C[I would play here.
+
+Black is ahead by 42.6 points.];W[fr];B[bj];W[bi]))
+(;W[cl]C[I would play here.
+
+Black is ahead by 32.6 points.];B[bl];W[bk];B[bq]))
+(;B[bq]C[I would play here.
+
+Black is ahead by 42.8 points.];W[fr];B[bj];W[bi]))
+(;W[cl]C[I would play here.
+
+Black is ahead by 32.8 points.];B[bl];W[bk];B[bq]))
+(;B[bj]C[I would play here.
+
+Black is ahead by 42.3 points.];W[ob];B[oc]))
+(;W[cl]C[I would play here.
+
+Black is ahead by 32.2 points.];B[bl];W[bk];B[fr]))
+(;W[jb]C[I would play here.
+
+Black is ahead by 3.9 points.];B[kd];W[ob];B[oc]))
+(;B[jb]C[I would play here.
+
+Black is ahead by 14.0 points.];W[ih];B[kb];W[hc]))
+(;W[je]C[I would play here.
+
+White is ahead by 15.0 points.];B[jb];W[kb];B[lb]))
+(;B[jb]C[I would play here.
+
+Black is ahead by 6.7 points.];W[kb];B[lb];W[ka]))
+(;B[jb]C[I would play here.
+
+Black is ahead by 15.7 points.];W[kb];B[kg];W[ie]))
+(;W[ic]C[I would play here.
+
+Black is ahead by 2.3 points.];B[hc];W[lb];B[mc];W[jb]))
+(;B[me]C[I would play here.
+
+Black is ahead by 11.7 points.];W[ke];B[mc];W[ic]))
+(;B[mc]C[I would play here.
+
+Black is ahead by 29.9 points.];W[ke];B[jb];W[oc];B[ob]))
+(;W[ke]C[I would play here.
+
+Black is ahead by 20.2 points.];B[jb];W[kf];B[kg];W[jf]))
+(;B[je]C[I would play here.
+
+Black is ahead by 32.7 points.];W[mc];B[nd];W[jb];B[ib]))
+(;W[je]C[I would play here.
+
+Black is ahead by 24.5 points.];B[jb];W[kf];B[kg]))
+(;B[ib]C[I would play here.
+
+Black is ahead by 35.9 points.];W[rg];B[sh]))
+(;W[kf]C[I would play here.
+
+Black is ahead by 19.7 points.];B[kg];W[jc];B[ib]))
+(;B[jc]C[I would play here.
+
+Black is ahead by 35.2 points.];W[ph];B[pi];W[qh]))
+(;W[oc]C[I would play here.
+
+Black is ahead by 26.3 points.];B[ob];W[nb]))
+(;W[re]C[I would play here.
+
+White is ahead by 0.9 points.];B[rg];W[qc];B[pc];W[qb]))
+(;B[rg]C[I would play here.
+
+Black is ahead by 12.8 points.];W[qd];B[qc];W[rc]))
+(;W[re]C[I would play here.
+
+White is ahead by 10.3 points.];B[rg];W[qb];B[qc]))
+(;B[rh]C[I would play here.
+
+Black is ahead by 6.6 points.];W[pn];B[om];W[pm];B[pg]))
+(;W[qd]C[I would play here.
+
+White is ahead by 9.5 points.];B[qc];W[rc];B[qb]))
+(;B[re]C[I would play here.
+
+Black is ahead by 3.0 points.];W[qd];B[qc];W[qi];B[rj]))
+(;W[qf]C[I would play here.
+
+White is ahead by 3.5 points.];B[rf];W[qe]))
+(;W[od]C[I would play here.
+
+White is ahead by 5.3 points.];B[oc];W[pe];B[qd];W[qe]))
+(;W[qf]C[I would play here.
+
+White is ahead by 6.5 points.];B[rf];W[qe]))
+(;B[qe]C[I would play here.
+
+Black is ahead by 4.3 points.];W[kf];B[le];W[jd]))
+(;W[qf]C[I would play here.
+
+White is ahead by 3.2 points.];B[rf];W[qe]))
+(;W[oe]C[I would play here.
+
+White is ahead by 2.3 points.];B[pf];W[of]))
+(;B[ne]C[I would play here.
+
+Black is ahead by 9.0 points.];W[oe];B[od];W[qf]))
+(;W[qf]C[I would play here.
+
+White is ahead by 7.4 points.];B[pf];W[pg];B[qh]))
+(;B[en]C[I would play here.
+
+Black is ahead by 6.0 points.];W[em];B[dn];W[oe];B[pe]))
+(;W[ne]C[I would play here.
+
+White is ahead by 2.2 points.];B[ph];W[ni];B[me]))
+(;B[nd]C[I would play here.
+
+Black is ahead by 9.0 points.];W[qf];B[rg];W[oe]))
+(;W[oe]C[I would play here.
+
+Black is ahead by 0.2 points.];B[pf];W[of]))
+(;B[ph]C[I would play here.
+
+Black is ahead by 9.4 points.];W[oe];B[qe];W[md]))
+(;W[oe]C[I would play here.
+
+Black is ahead by 0.5 points.];B[qe];W[od];B[md]))
+(;B[ph]C[I would play here.
+
+Black is ahead by 10.7 points.];W[oe];B[ni]))
+(;W[pi]C[I would play here.
+
+Black is ahead by 1.3 points.];B[rh];W[oe];B[pf]))
+(;B[ph]C[I would play here.
+
+Black is ahead by 11.8 points.];W[oe];B[pf]))
+(;B[ne]C[I would play here.
+
+Black is ahead by 22.7 points.];W[qf];B[rg];W[pf]))
+(;W[ph]C[I would play here.
+
+White is ahead by 4.9 points.];B[mi];W[qh];B[oi]))
+(;W[mi]C[I would play here.
+
+White is ahead by 16.7 points.];B[nj];W[oh]))
+(;W[en]C[I would play here.
+
+White is ahead by 26.1 points.];B[lk];W[er]))
+(;B[fm]C[I would play here.
+
+White is ahead by 12.4 points.];W[jn];B[jl];W[km]))
+(;W[fm]C[I would play here.
+
+White is ahead by 22.1 points.];B[en];W[dn];B[em]))
+(;W[hn]C[I would play here.
+
+White is ahead by 18.8 points.];B[go];W[in];B[do]))
+(;B[lm]C[I would play here.
+
+White is ahead by 12.2 points.];W[nk];B[kk];W[pi]))+
No newline at end of file
diff --git a/static/besogo/besogo.min.js b/static/besogo/besogo.min.js
@@ -0,0 +1,73 @@
+(function(){function q(b,a){b.getAttribute("tabindex")||b.setAttribute("tabindex","0");b.addEventListener("keydown",function(c){c=c||window.event;switch(c.keyCode){case 33:a.prevNode(10);break;case 34:a.nextNode(10);break;case 35:a.nextNode(-1);break;case 36:a.prevNode(-1);break;case 37:c.shiftKey?a.prevBranchPoint():a.prevNode(1);break;case 38:a.nextSibling(-1);break;case 39:a.nextNode(1);break;case 40:a.nextSibling(1);break;case 46:a.cutCurrent()}33<=c.keyCode&&40>=c.keyCode&&c.preventDefault()})}
+function l(b,a){b.addEventListener("wheel",function(c){c=c||window.event;0<c.deltaY?(a.nextNode(1),c.preventDefault()):0>c.deltaY&&(a.prevNode(1),c.preventDefault())})}function m(b,a){try{var c=e.parseSgf(b)}catch(g){return}e.loadSgf(c,a)}function t(b,a,c){var g=new XMLHttpRequest;g.onreadystatechange=function(){4===g.readyState&&200===g.status&&(m(g.responseText,a),w(a,c))};g.overrideMimeType("text/plain");g.open("GET",b,!0);g.send()}function w(b,a){function c(d,p){var h;d=d.split(/D+/);for(h=0;h<
+d.length;h++)d[h]&&(p?b.getCurrent().children.length&&(b.nextNode(1),b.nextSibling(d[h]-1)):b.nextNode(+d[h]))}var g,f;a=a.split(/[Nn]+/);for(g=0;g<a.length;g++){var k=a[g].split(/[Bb]+/);c(k[0],!1);for(f=1;f<k.length;f++)c(k[f],!0)}}var e=window.besogo=window.besogo||{};e.VERSION="0.0.2-alpha";e.create=function(b,a){function c(v,r){r&&v>r?(b.style["flex-direction"]="row",p.style.height=r+"px",p.style.width=r+"px",h&&(h.style.height=r+"px",h.style.width=v-r+"px")):(b.style["flex-direction"]="column",
+p.style.height=v+"px",p.style.width=v+"px",h&&(r&&(h.style.height=r-v+"px"),h.style.width=v+"px"))}function g(v,r){var B=document.createElement("div");v&&(B.className=v);r=r||b;r.appendChild(B);return B}var f={control:e.makeControlPanel,names:e.makeNamesPanel,comment:e.makeCommentPanel,tool:e.makeToolPanel,tree:e.makeTreePanel,file:e.makeFilePanel},k=b.textContent||b.innerText||"";b.className+=" besogo-container";a=a||{};a.size=e.parseSize(a.size||19);a.coord=a.coord||"none";a.tool=a.tool||"auto";
+""===a.panels&&(a.panels=[]);a.panels=a.panels||"control+names+comment+tool+tree+file";"string"===typeof a.panels&&(a.panels=a.panels.split("+"));a.path=a.path||"";void 0===a.shadows?a.shadows="auto":"off"===a.shadows&&(a.shadows=!1);var d=e.makeEditor(a.size.x,a.size.y);b.besogoEditor=d;d.setTool(a.tool);d.setCoordStyle(a.coord);a.realstones?(d.REAL_STONES=!0,d.SHADOWS=a.shadows):d.SHADOWS=a.shadows&&"auto"!==a.shadows;a.nokeys||q(b,d);if(a.sgf){k=!1;try{new URL(a.sgf),k=!0}catch(v){}try{k?t(a.sgf,
+d,a.path):(m(a.sgf,d),w(d,a.path))}catch(v){console.error(v)}}else k.match(/s*(s*;/)&&(m(k,d),w(d,a.path));for("number"!==typeof a.variants&&"string"!==typeof a.variants||d.setVariantStyle(+a.variants);b.firstChild;)b.removeChild(b.firstChild);var p=g("besogo-board");e.makeBoardDisplay(p,d);a.nowheel||l(p,d);if(0<a.panels.length){var h=g("besogo-panels");for(k=0;k<a.panels.length;k++){var u=a.panels[k];if(f[u])f[u](g("besogo-"+u,h),d)}h.firstChild||(b.removeChild(h),h=!1)}a.resize=a.resize||"auto";
+"auto"===a.resize?(d=function(){var v=window.innerHeight,r=parseFloat(getComputedStyle(b.parentElement).width),B=+(a.maxwidth||-1),D=a.orient||"auto",n=+(a.portratio||200)/100,z=+(a.landratio||200)/100,C=+(a.minpanelswidth||350),I=+(a.minpanelsheight||400),M=+(a.transwidth||600);r=0<B&&B<r?B:r;"portrait"!==D&&"landscape"!==D&&(D=r<M||"view"===D&&r<v?"portrait":"landscape");if("portrait"===D){if(!isNaN(n)){var N=n*r;h&&(N=N-r<I?r+I:N)}}else"landscape"===D&&(N=h?isNaN(z)?v:r/z:r,h&&(N=r<N+C?r-C:N));
+c(r,N);b.style.width=r+"px"},window.addEventListener("resize",d),d()):"fixed"===a.resize?c(b.clientWidth,b.clientHeight):"fill"===a.resize&&(d=function(){var v=parseFloat(getComputedStyle(b.parentElement).height),r=parseFloat(getComputedStyle(b.parentElement).width),B=+(a.minpanelswidth||350),D=+(a.minpanelsheight||300),n=0,z=0;r>=v?(b.style["flex-direction"]="row",h&&(n=r-v>=B?r-v:B),h.style.height=v+"px",h.style.width=n+"px",p.style.height=v+"px",p.style.width=r-n+"px"):(b.style["flex-direction"]=
+"column",h&&(z=v-r>=D?v-r:D),h.style.height=z+"px",h.style.width=r+"px",p.style.height=v-z+"px",p.style.width=r+"px")},window.addEventListener("resize",d),d())};e.parseSize=function(b){var a;b=(b+"").replace(/s/g,"");if(a=b.match(/^(d+):(d+)$/)){var c=+a[1];b=+a[2]}else b.match(/^d+$/)?(c=+b,b=+b):c=b=19;if(52<c||1>c||52<b||1>b)c=b=19;return{x:c,y:b}};e.autoInit=function(){function b(d,p){return-1!==d.className.split(" ").indexOf(p)}var a=document.getElementsByTagName("div"),c=[],g,f;for(g=0;g<
+a.length;g++)(b(a[g],"besogo-editor")||b(a[g],"besogo-viewer")||b(a[g],"besogo-diagram"))&&!b(a[g],"besogo-container")&&c.push(a[g]);for(g=0;g<c.length;g++){a={};b(c[g],"besogo-editor")?(a.panels="control names comment tool tree file".split(" "),a.tool="auto"):b(c[g],"besogo-viewer")?(a.panels=["control","names","comment"],a.tool="navOnly"):b(c[g],"besogo-diagram")&&(a.panels=[],a.tool="navOnly");var k=c[g].attributes;for(f=0;f<k.length;f++)a[k[f].name]=k[f].value;e.create(c[g],a)}}})();besogo.makeBoardDisplay=function(q,l){function m(){Q=!0;M=[];D.removeChild(C);q.removeEventListener("touchstart",m)}function t(A){var x="";v=("none"===A?0:75)+6;var y=2*v+88*r;var H=2*v+88*B;D=besogo.svgEl("svg",{width:"100%",height:"100%",viewBox:"0 0 "+y+" "+H});D.appendChild(besogo.svgEl("rect",{width:y,height:H,"class":"besogo-svg-board"}));D.appendChild(besogo.svgEl("rect",{width:88*(r-1),height:88*(B-1),x:h(1),y:h(1),"class":"besogo-svg-lines"}));for(y=2;y<=B-1;y++)x+="M"+h(1)+","+h(y)+"h"+
+88*(r-1);for(y=2;y<=r-1;y++)x+="M"+h(y)+","+h(1)+"v"+88*(B-1);D.appendChild(besogo.svgEl("path",{d:x,"class":"besogo-svg-lines"}));e();"none"!==A&&w(A);n=besogo.svgEl("g");z=besogo.svgEl("g");D.appendChild(n);D.appendChild(z);Q||(C=besogo.svgEl("g"),D.appendChild(C));for(x=1;x<=r;x++)for(y=1;y<=B;y++)A=besogo.svgEl("rect",{x:h(x)-44,y:h(y)-44,width:88,height:88,opacity:0}),A.addEventListener("click",b(x,y)),Q||(A.addEventListener("mouseover",a(x,y)),A.addEventListener("mouseout",c(x,y))),D.appendChild(A);
+if(l.REAL_STONES)for(A=besogo.BLACK_STONES*besogo.WHITE_STONES,N=[],x=1;x<=r;x++)for(y=1;y<=B;y++)N[u(x,y)]=Math.floor(Math.random()*A)}function w(A){function x(G,E,O){G=besogo.svgEl("text",{x:G,y:E,dy:".65ex","font-size":32,"text-anchor":"middle","font-family":"Helvetica, Arial, sans-serif",fill:"black"});G.appendChild(document.createTextNode(O));D.appendChild(G)}var y=besogo.coord[A](r,B),H=y.x,K=y.xb||y.x;A=y.y;y=y.yb||y.y;var F;for(F=1;F<=r;F++){var J=h(F);x(J,h(1)-85,H[F]);x(J,h(B)+85,K[F])}for(F=
+1;F<=B;F++)H=h(F),x(h(1)-85,H,A[F]),x(h(r)+85,H,y[F])}function e(){function A(K,F){x+="M"+h(K)+","+h(F)+"l0,0"}var x="";if(r%2&&B%2){var y=(r-1)/2+1;var H=(B-1)/2+1;A(y,H);17<=r&&17<=B&&(A(4,H),A(r-3,H),A(y,4),A(y,B-3))}11<=r&&11<=B?(A(4,4),A(4,B-3),A(r-3,4),A(r-3,B-3)):8<=r&&8<=B&&(A(3,3),A(3,B-2),A(r-2,3),A(r-2,B-2));x&&D.appendChild(besogo.svgEl("path",{d:x,"stroke-linecap":"round","class":"besogo-svg-hoshi"}))}function b(A,x){return function(y){l.click(A,x,y.ctrlKey,y.shiftKey);Q||a(A,x)()}}function a(A,
+x){return function(){var y=M[u(A,x)];y&&y.setAttribute("visibility","visible")}}function c(A,x){return function(){var y=M[u(A,x)];y&&y.setAttribute("visibility","hidden")}}function g(A){var x=besogo.svgEl("g"),y,H,K;if(l.SHADOWS){var F=besogo.svgShadowGroup();x.appendChild(F)}for(y=1;y<=r;y++)for(H=1;H<=B;H++)if(K=A.getStone(y,H)){var J=h(y);var G=h(H);l.REAL_STONES?x.appendChild(besogo.realStone(J,G,K,N[u(y,H)])):x.appendChild(besogo.svgStone(J,G,K));l.SHADOWS&&(F.appendChild(besogo.svgShadow(J-
+2,G-4)),F.appendChild(besogo.svgShadow(J+2,G+4)))}D.replaceChild(x,n);n=x}function f(A){var x,y,H=besogo.svgEl("g"),K=A.move,F=l.getVariants(),J;I=[];for(x=1;x<=r;x++)for(y=1;y<=B;y++)if(J=A.getMarkup(x,y)){var G=h(x);var E=h(y);var O=A.getStone(x,y);var P=-1===O?"white":"black";K&&K.x===x&&K.y===y?P=d(F,A,x,y)?besogo.PURP:besogo.BLUE:d(F,A,x,y)&&(P=besogo.RED);if("number"===typeof J)switch(J){case 1:var L=besogo.svgCircle(G,E,P);break;case 2:L=besogo.svgSquare(G,E,P);break;case 3:L=besogo.svgTriangle(G,
+E,P);break;case 4:L=besogo.svgCross(G,E,P);break;case 5:L=besogo.svgBlock(G,E,P)}else O||(L=k(G,E),H.appendChild(L)),L=besogo.svgLabel(G,E,P,J);H.appendChild(L);I[u(x,y)]=L}K&&0!==K.x&&0!==K.y&&(x=K.x,y=K.y,I[u(x,y)]||(P=d(F,A,x,y)?besogo.PURP:besogo.BLUE,L=besogo.svgPlus(h(x),h(y),P),H.appendChild(L),I[u(x,y)]=L));for(x=0;x<F.length;x++)F[x]!==A&&(L=F[x].move)&&0!==L.x&&!I[u(L.x,L.y)]&&(E=A.getStone(L.x,L.y),y=h(L.x),G=h(L.y),E||(E=k(y,G),H.appendChild(E)),E=String.fromCharCode(65+x%26),E=besogo.svgLabel(y,
+G,besogo.LRED,E),H.appendChild(E),I[u(L.x,L.y)]=E);D.replaceChild(H,z);z=H}function k(A,x){return besogo.svgEl("rect",{x:A-44,y:x-44,height:88,width:88,opacity:.85,stroke:"none","class":"besogo-svg-board besogo-svg-backer"})}function d(A,x,y,H){var K,F;for(K=0;K<A.length;K++)if(A[K]!==x&&(F=A[K].move)&&F.x===y&&F.y===H)return!0;return!1}function p(A){if(!Q){var x,y,H=besogo.svgEl("g"),K=l.getTool(),F;M=[];H.setAttribute("opacity","0.35");if("navOnly"===K)for(A=A.children,x=0;x<A.length;x++){if((F=
+A[x].move)&&0!==F.x){var J=h(F.x);var G=h(F.y);var E=besogo.svgStone(J,G,F.color);E.setAttribute("visibility","hidden");H.appendChild(E);M[u(F.x,F.y)]=E}}else for(x=1;x<=r;x++)for(y=1;y<=B;y++){E=null;J=h(x);G=h(y);F=A.getStone(x,y);var O=-1===F?"white":"black";switch(K){case "auto":E=besogo.svgStone(J,G,A.nextMove());break;case "playB":E=besogo.svgStone(J,G,-1);break;case "playW":E=besogo.svgStone(J,G,1);break;case "addB":-1===F?E=besogo.svgCross(J,G,besogo.RED):(E=besogo.svgEl("g"),E.appendChild(besogo.svgStone(J,
+G,-1)),E.appendChild(besogo.svgPlus(J,G,besogo.RED)));break;case "addW":1===F?E=besogo.svgCross(J,G,besogo.RED):(E=besogo.svgEl("g"),E.appendChild(besogo.svgStone(J,G,1)),E.appendChild(besogo.svgPlus(J,G,besogo.RED)));break;case "addE":F&&(E=besogo.svgCross(J,G,besogo.RED));break;case "circle":E=besogo.svgCircle(J,G,O);break;case "square":E=besogo.svgSquare(J,G,O);break;case "triangle":E=besogo.svgTriangle(J,G,O);break;case "cross":E=besogo.svgCross(J,G,O);break;case "block":E=besogo.svgBlock(J,G,
+O);break;case "label":E=besogo.svgLabel(J,G,O,l.getLabel())}E&&(E.setAttribute("visibility","hidden"),H.appendChild(E),M[u(x,y)]=E)}D.replaceChild(H,C);C=H}}function h(A){return v+44+88*(A-1)}function u(A,x){return(A-1)*B+(x-1)}var v,r=l.getCurrent().getSize().x,B=l.getCurrent().getSize().y,D,n,z,C,I,M,N,Q=!1;t(l.getCoordStyle());q.appendChild(D);l.addListener(function(A){var x=l.getCurrent(),y=x.getSize(),H=!1,K=D;if(y.x!==r||y.y!==B||A.coord)r=y.x,B=y.y,t(A.coord||l.getCoordStyle()),q.replaceChild(D,
+K),H=!0;H||A.navChange||A.stoneChange?(g(x),f(x),p(x)):A.markupChange||A.treeChange?(f(x),p(x)):(A.tool||A.label)&&p(x)});(function(A){g(A);f(A);p(A)})(l.getCurrent());q.addEventListener("touchstart",m)};besogo.makeCommentPanel=function(q,l){function m(d){if(d.navChange){var p=l.getCurrent().comment||"";var h=a;p=document.createTextNode(p);h.replaceChild(p,w.C);w.C=p;l.getCurrent()===l.getRoot()&&e.firstChild&&"none"===b.style.display?e.style.display="table":e.style.display="none";c.style.display="none";a.style.display="block"}else void 0!==d.comment&&(h=a,p=document.createTextNode(d.comment),h.replaceChild(p,w.C),w.C=p,c.value=d.comment);if(d.gameInfo){h=d.gameInfo;p=document.createElement("table");
+var u;p.className="besogo-gameInfo";for(u=0;u<f.length;u++){var v=f[u];if(h[v]){var r=document.createElement("tr");p.appendChild(r);var B=document.createElement("td");B.appendChild(document.createTextNode(k[v]));r.appendChild(B);B=document.createElement("td");v=document.createTextNode(h[v]);B.appendChild(v);r.appendChild(B)}}p.firstChild&&"none"!==e.style.display||(p.style.display="none");q.replaceChild(p,e);e=p;t(d.gameInfo)}}function t(d){var p=document.createElement("table"),h=g.concat(f),u;p.className=
+"besogo-gameInfo";for(u=0;u<h.length;u++){var v=h[u];var r=document.createElement("tr");p.appendChild(r);var B=document.createElement("td");B.appendChild(document.createTextNode(k[v]));r.appendChild(B);B=document.createElement("td");var D=document.createElement("input");d[v]&&(D.value=d[v]);D.onblur=function(n,z){return function(){l.setGameInfo(n.value,z)}}(D,v);D.addEventListener("keydown",function(n){n=n||window.event;n.stopPropagation()});B.appendChild(D);r.appendChild(B)}"none"===b.style.display&&
+(p.style.display="none");q.replaceChild(p,b);b=p}var w={},e=document.createElement("table"),b=document.createElement("table"),a=document.createElement("div"),c=document.createElement("textarea"),g="PW WR WT PB BR BT".split(" "),f="HA KM RU TM OT GN EV PC RO DT RE ON GC AN US SO CP".split(" "),k={PW:"White Player",WR:"White Rank",WT:"White Team",PB:"Black Player",BR:"Black Rank",BT:"Black Team",HA:"Handicap",KM:"Komi",RU:"Rules",TM:"Timing",OT:"Overtime",GN:"Game Name",EV:"Event",PC:"Place",RO:"Round",
+DT:"Date",RE:"Result",ON:"Opening",GC:"Comments",AN:"Annotator",US:"Recorder",SO:"Source",CP:"Copyright"};q.appendChild(function(){var d=document.createElement("input");d.type="button";d.value="Info";d.title="Show/hide game info";d.onclick=function(){e.style.display="none"===e.style.display&&e.firstChild?"table":"none";b.style.display="none"};return d}());q.appendChild(function(){var d=document.createElement("input");d.type="button";d.value="Edit Info";d.title="Edit game info";d.onclick=function(){b.style.display=
+"none"===b.style.display?"table":"none";e.style.display="none"};return d}());q.appendChild(function(){var d=document.createElement("input");d.type="button";d.value="Comment";d.title="Edit comment";d.onclick=function(){"none"===c.style.display?(a.style.display="none",e.style.display="none",c.value=l.getCurrent().comment,c.style.display="block"):(c.style.display="none",a.style.display="block")};return d}());q.appendChild(e);q.appendChild(b);w.C=document.createTextNode("");q.appendChild(a);a.appendChild(w.C);
+q.appendChild(c);c.onblur=function(){l.setComment(c.value)};c.addEventListener("keydown",function(d){d=d||window.event;d.stopPropagation()});l.addListener(m);m({navChange:!0,gameInfo:l.getGameInfo()});b.style.display="none"};besogo.makeControlPanel=function(q,l){function m(d){function p(u){u%2?(g.setAttribute("fill","black"),f.setAttribute("fill",besogo.BLUE),a.title="Variants: child/[sibling]"):(g.setAttribute("fill",besogo.BLUE),f.setAttribute("fill",besogo.RED),a.title="Variants: [child]/sibling");2<=u?(k.setAttribute("visibility","visible"),c.title="Variants: show/[hide]"):(k.setAttribute("visibility","hidden"),c.title="Variants: [show]/hide")}function h(u,v){var r;for(r=0;r<u.length;r++)u[r].setAttribute("fill",
+v)}void 0!==d.variantStyle&&p(d.variantStyle);if(d.navChange||d.treeChange)d=l.getCurrent(),d.parent?(h(w,"black"),1<d.parent.children.length?h(b,"black"):h(b,besogo.GREY)):(h(w,besogo.GREY),h(b,besogo.GREY)),d.children.length?h(e,"black"):h(e,besogo.GREY)}function t(){return besogo.svgEl("svg",{width:"100%",height:"100%",viewBox:"0 0 100 100"})}var w=[],e=[],b=[],a,c,g,f,k;(function(){function d(p,h,u){var v=document.createElement("button"),r=t();h=besogo.svgEl("polygon",{points:h,stroke:"none",
+fill:"black"});v.title=p;v.onclick=u;v.appendChild(r);r.appendChild(h);q.appendChild(v);return h}w.push(d("First node","5,10 5,90 25,90 25,50 95,90 95,10 25,50 25,10",function(){l.prevNode(-1)}));w.push(d("Jump back","95,10 50,50 50,10 5,50 50,90 50,50 95,90",function(){l.prevNode(10)}));w.push(d("Previous node","85,10 85,90 15,50",function(){l.prevNode(1)}));e.push(d("Next node","15,10 15,90 85,50",function(){l.nextNode(1)}));e.push(d("Jump forward","5,10 50,50 50,10 95,50 50,90 50,50 5,90",function(){l.nextNode(10)}));
+e.push(d("Last node","95,10 95,90 75,90 75,50 5,90 5,10 75,50 75,10",function(){l.nextNode(-1)}));b.push(d("Previous sibling","10,85 90,85 50,15",function(){l.nextSibling(-1)}));b.push(d("Next sibling","10,15 90,15 50,85",function(){l.nextSibling(1)}))})();(function(){a=document.createElement("button");a.onclick=function(){l.toggleVariantStyle(!1)};q.appendChild(a);var d=t();a.appendChild(d);var p=besogo.svgEl("path",{d:"m75,25h-50l50,50",stroke:"black","stroke-width":5,fill:"none"});d.appendChild(p);
+g=besogo.svgEl("circle",{cx:25,cy:25,r:20,stroke:"none"});d.appendChild(g);f=besogo.svgEl("circle",{cx:75,cy:25,r:20,stroke:"none"});d.appendChild(f);p=besogo.svgEl("circle",{cx:75,cy:75,r:20,fill:besogo.RED,stroke:"none"});d.appendChild(p);c=document.createElement("button");c.onclick=function(){l.toggleVariantStyle(!0)};q.appendChild(c);d=t();c.appendChild(d);d.appendChild(besogo.svgLabel(50,50,besogo.RED,"A"));k=besogo.svgCross(50,50,"black");d.appendChild(k);p=document.createElement("button");
+p.onclick=function(){l.toggleCoordStyle()};p.title="Toggle coordinates";q.appendChild(p);d=t();p.appendChild(d);d.appendChild(besogo.svgLabel(50,50,"black","u56db4"))})();l.addListener(m);m({navChange:!0,variantStyle:l.getVariantStyle()})};(function(){function q(m){return"ABCDEFGHJKLMNOPQRSTUVWXYZ".charAt((m-1)%25)}function l(m){var t="";20<=m?t="u4e00u4e8cu4e09u56dbu4e94u516du4e03u516bu4e5d".charAt(m/10-1)+"u5341":10<=m&&(t="u5341");m%10&&(t+="u4e00u4e8cu4e09u56dbu4e94u516du4e03u516bu4e5d".charAt((m-1)%10));return t}besogo.coord={};besogo.coord.none=function(m,t){return!1};besogo.coord.western=function(m,t){var w={x:[],y:[]},e;for(e=1;e<=m;e++)w.x[e]=q(e);for(e=1;e<=t;e++)w.y[e]=t-e+1+"";return w};besogo.coord.numeric=
+function(m,t){var w={x:[],y:[]},e;for(e=1;e<=m;e++)w.x[e]=e+"";for(e=1;e<=t;e++)w.y[e]=e+"";return w};besogo.coord.pierre=function(m,t){var w={x:[],xb:[],y:[],yb:[]},e;for(e=1;e<=m/2;e++)w.x[e]="a"+e,w.x[m-e+1]="b"+e,w.xb[e]="d"+e,w.xb[m-e+1]="c"+e;m%2&&(e=Math.ceil(m/2),w.x[e]="a",w.xb[e]="c");for(e=1;e<=t/2;e++)w.y[e]="a"+e,w.y[t-e+1]="d"+e,w.yb[e]="b"+e,w.yb[t-e+1]="c"+e;t%2&&(e=Math.ceil(t/2),w.y[e]="d",w.yb[e]="b");return w};besogo.coord.corner=function(m,t){var w={x:[],y:[]},e;for(e=1;e<=m;e++)w.x[e]=
+e<m/2+1?q(e):m-e+1+"";for(e=1;e<=t;e++)w.y[e]=t-e+1+"",w.y[e]=e>t/2?q(t-e+1):e+"";return w};besogo.coord.eastcor=function(m,t){var w={x:[],y:[]},e;for(e=1;e<=m;e++)w.x[e]=e<m/2+1?l(e):m-e+1+"";for(e=1;e<=t;e++)w.y[e]=t-e+1+"",w.y[e]=e>t/2?l(t-e+1):e+"";return w};besogo.coord.eastern=function(m,t){var w={x:[],y:[]},e;for(e=1;e<=m;e++)w.x[e]=e+"";for(e=1;e<=t;e++)w.y[e]=l(e);return w}})();besogo.makeEditor=function(q,l){function m(n){"string"===typeof n&&(h=(n=n.replace(/s/g," ").trim())||"1",p="label",c({tool:p,label:h}))}function t(n,z,C){var I,M=f.children;for(I=0;I<M.length;I++){var N=M[I].move;if(C){if(w(n,z,M[I]))return!0}else if(N&&N.x===n&&N.y===z)return f=M[I],c({navChange:!0}),!0}return C&&w(n,z,g,f)?!0:!1}function w(n,z,C,I){var M,N=C.children;if(I&&I===C)return!1;if((M=C.move)&&M.x===n&&M.y===z)return f=C,c({navChange:!0}),!0;for(C=0;C<N.length;C++)if(w(n,z,N[C],I))return!0;
+return!1}function e(n,z,C,I){if(f.isMutable("move")&&f.parent)f.playMove(n,z,C,I)&&c({stoneChange:!0});else{var M=f.makeChild();M.playMove(n,z,C,I)&&(f.addChild(M),f=M,c({treeChange:!0,navChange:!0,stoneChange:!0}))}}function b(n,z,C){if(C===f.getStone(n,z))if(0!==C)C=0;else return;if(f.isMutable("setup"))f.placeSetup(n,z,C)&&c({stoneChange:!0});else{var I=f.makeChild();I.placeSetup(n,z,C)&&(f.addChild(I),f=I,c({treeChange:!0,navChange:!0,stoneChange:!0}))}}function a(n,z,C){if(C===f.getMarkup(n,
+z))if(0!==C)C=0;else return;f.addMarkup(n,z,C)&&("string"===typeof C&&(/^-?d+$/.test(C)?m(""+(+C+1)):/[A-Za-z]$/.test(C)&&(n=C.charAt(C.length-1),n="z"===n?"A":"Z"===n?"a":String.fromCharCode(n.charCodeAt()+1),m(C.slice(0,C.length-1)+n))),c({markupChange:!0}))}function c(n,z){!z&&n.navChange&&(u=[]);for(z=0;z<k.length;z++)k[z](n)}var g=besogo.makeGameRoot(q,l),f=g,k=[],d="navOnly auto playB playW addB addW addE clrMark circle square triangle cross block label".split(" "),p="auto",h="1",u=[],v={},
+r="none numeric western eastern pierre corner eastcor".split(" "),B="none",D=0;return{addListener:function(n){k.push(n)},click:function(n,z,C,I){switch(p){case "navOnly":t(n,z,I);break;case "auto":t(n,z,I)||I||e(n,z,0,C);break;case "playB":e(n,z,-1,C);break;case "playW":e(n,z,1,C);break;case "addB":C?e(n,z,-1,!0):b(n,z,-1);break;case "addW":C?e(n,z,1,!0):b(n,z,1);break;case "addE":b(n,z,0);break;case "clrMark":a(n,z,0);break;case "circle":a(n,z,1);break;case "square":a(n,z,2);break;case "triangle":a(n,
+z,3);break;case "cross":a(n,z,4);break;case "block":a(n,z,5);break;case "label":a(n,z,h)}},nextNode:function(n){if(0===f.children.length)return!1;for(;0<f.children.length&&0!==n;)f=u.length?u.pop():f.children[0],n--;c({navChange:!0},!0)},prevNode:function(n){if(null===f.parent)return!1;for(;f.parent&&0!==n;)u.push(f),f=f.parent,n--;c({navChange:!0},!0)},nextSibling:function(n){if(f.parent){var z=f.parent.children;if(1!==z.length){var C=z.indexOf(f);C=(C+n)%z.length;0>C&&(C+=z.length);f=z[C];c({navChange:!0})}}},
+prevBranchPoint:function(n){if(null===f.parent)return!1;for(u.push(f);f.parent&&1===f.parent.children.length;)f=f.parent;if(f.parent)f=f.parent,c({navChange:!0});else return f=u.pop(f),!1},toggleCoordStyle:function(){B=r[(r.indexOf(B)+1)%r.length];c({coord:B})},getCoordStyle:function(){return B},setCoordStyle:function(n){besogo.coord[n]&&(B=n,c({coord:n}))},toggleVariantStyle:function(n){var z=D%2,C=D-z;n?C=(C+2)%4:z=(z+1)%2;D=z+C;c({variantStyle:D,markupChange:!0})},getVariantStyle:function(){return D},
+setVariantStyle:function(n){if(0===n||1===n||2===n||3===n)D=n,c({variantStyle:D,markupChange:!0})},getGameInfo:function(){return v},setGameInfo:function(n,z){z?v[z]=n:v=n;c({gameInfo:v})},setComment:function(n){n=n.trim();n=n.replace(/rn/g,"n").replace(/nr/g,"n").replace(/r/g,"n");n.replace(/ftvu0085u00a0/g," ");f.comment=n;c({comment:n})},getTool:function(){return p},setTool:function(n){return"label"===n&&n===p?(/^-?d+$/.test(h)?m("A"):m("1"),!0):-1!==d.indexOf(n)&&p!==n?(p=n,c({tool:p,
+label:h}),!0):!1},getLabel:function(){return h},setLabel:m,getVariants:function(){return 2<=D?[]:1===D?f.parent?f.parent.children:[]:f.children},getCurrent:function(){return f},setCurrent:function(n){f!==n&&(f=n,c({navChange:!0}))},cutCurrent:function(){var n=f.parent;"navOnly"!==p&&n&&!0===confirm("Delete this branch?")&&(n.removeChild(f),f=n,c({treeChange:!0,navChange:!0}))},promote:function(){"navOnly"!==p&&f.parent&&f.parent.promote(f)&&c({treeChange:!0})},demote:function(){"navOnly"!==p&&f.parent&&
+f.parent.demote(f)&&c({treeChange:!0})},getRoot:function(){return g},loadRoot:function(n){f=g=n;c({treeChange:!0,navChange:!0,stoneChange:!0})}}};besogo.makeFilePanel=function(q,l){function m(a){var c=document.createElement("input");c.type="button";c.value=a+"x"+a;"?"===a?(c.title="New custom size board",c.onclick=function(){var g=prompt("Enter custom size for new boardnEverything not saved will be lost","19:19");g&&(g=besogo.parseSize(g),l.loadRoot(besogo.makeGameRoot(g.x,g.y)),l.setGameInfo({}))}):(c.title="New "+a+"x"+a+" board",c.onclick=function(){confirm(c.title+"?nEverything not saved will be lost")&&(l.loadRoot(besogo.makeGameRoot(a,
+a)),l.setGameInfo({}))});q.appendChild(c)}function t(){var a=document.createElement("input");a.type="file";a.style.display="none";a.onchange=w;return a}function w(a){a=a.target.files[0];var c=new FileReader,g=t();q.replaceChild(g,e);e=g;c.onload=function(f){try{var k=besogo.parseSgf(f.target.result)}catch(d){alert("SGF parse error at "+d.at+":n"+d.message);return}besogo.loadSgf(k,l)};confirm("Load '"+a.name+"'?nEverything not saved will be lost")&&c.readAsText(a)}m(9);m(13);m(19);m("?");var e=t();
+q.appendChild(e);var b=document.createElement("input");b.type="button";b.value="Open";b.title="Import SGF";b.onclick=function(){e.click()};q.appendChild(b);b=document.createElement("input");b.type="button";b.value="Save";b.title="Export SGF";b.onclick=function(){var a=prompt("Save file as","export.sgf");if(a){var c=besogo.composeSgf(l),g=document.createElement("a");c=new Blob([c],{encoding:"UTF-8",type:"text/plain;charset=UTF-8"});g.download=a;g.href=URL.createObjectURL(c);g.style.display="none";
+q.appendChild(g);g.click();q.removeChild(g)}};q.appendChild(b)};besogo.makeGameRoot=function(q,l){function m(b,a){b.parent=a;b.children=[];b.move=null;b.setupStones=[];b.markup=[];b.comment=""}function t(b,a,c,g,f){var k=[];if(!w(b,a,c,g,k))for(a=0;a<k.length;a++)b["board"+k[a].x+"-"+k[a].y]=0,f.push(k[a])}function w(b,a,c,g,f){var k;if(1>a||1>c||a>q||c>l||b.getStone(a,c)===g)return!1;if(!b.getStone(a,c))return!0;for(k=0;k<f.length;k++)if(f[k].x===a&&f[k].y===c)return!1;f.push({x:a,y:c});return w(b,a-1,c,g,f)||w(b,a+1,c,g,f)||w(b,a,c-1,g,f)||w(b,a,c+1,g,f)?!0:
+!1}var e={blackCaps:0,whiteCaps:0,moveNumber:0};m(e,null);e.playMove=function(b,a,c,g){var f=!1;if(!this.isMutable("move"))return!1;c||=this.nextMove();if(1>b||1>a||b>q||a>l)return this.move={x:0,y:0,color:c,captures:0,overwrite:!1},this.lastMove=c,this.moveNumber++,!0;if(this.getStone(b,a)){if(!g)return!1;f=!0}var k=Object.create(this);var d=[];k["board"+b+"-"+a]=c;t(k,b-1,a,c,d);t(k,b+1,a,c,d);t(k,b,a-1,c,d);t(k,b,a+1,c,d);var p=d.length;var h=this.parent?this.parent.move:null;if(!g&&h&&h.color===
+-c&&!1===h.overwrite&&1===h.captures&&1===p&&!k.getStone(h.x,h.y)||0===p&&(t(k,b,a,-c,d),p=-d.length,0>p&&!g))return!1;0>c*p?this.blackCaps+=Math.abs(p):this.whiteCaps+=Math.abs(p);this["board"+b+"-"+a]=c;for(g=0;g<d.length;g++)this["board"+d[g].x+"-"+d[g].y]=0;this.move={x:b,y:a,color:c,captures:p,overwrite:f};this.lastMove=c;this.moveNumber++;return!0};e.nextMove=function(){var b,a,c=0;if(this.lastMove)return-this.lastMove;for(b=1;b<=q;b++)for(a=1;a<=l;a++)c+=this.getStone(b,a);return 0>c?1:-1};
+e.placeSetup=function(b,a,c){var g=this.parent&&this.parent.getStone(b,a)||0;if(1>b||1>a||b>q||a>l||!this.isMutable("setup")||this.getStone(b,a)===c)return!1;this["board"+b+"-"+a]=c;this.setupStones[(b-1)*l+(a-1)]=c-g;return!0};e.addMarkup=function(b,a,c){if(1>b||1>a||b>q||a>l||this.getMarkup(b,a)===c)return!1;this.markup[(b-1)*l+(a-1)]=c;return!0};e.getStone=function(b,a){return this["board"+b+"-"+a]||0};e.getSetup=function(b,a){if(this.setupStones[(b-1)*l+(a-1)])switch(this.getStone(b,a)){case 0:return"AE";
+case -1:return"AB";case 1:return"AW"}else return!1};e.getMarkup=function(b,a){return this.markup[(b-1)*l+(a-1)]||0};e.getType=function(){var b;if(this.move)return"move";for(b=0;b<this.setupStones.length;b++)if(this.setupStones[b])return"setup";return"empty"};e.isMutable=function(b){return"move"===b&&"empty"===this.getType()&&0===this.children.length||"setup"===b&&"move"!==this.getType()&&0===this.children.length?!0:!1};e.getSiblings=function(){return this.parent&&this.parent.children||[]};e.makeChild=
+function(){var b=Object.create(this);m(b,this);return b};e.addChild=function(b){this.children.push(b)};e.removeChild=function(b){b=this.children.indexOf(b);return-1!==b?(this.children.splice(b,1),!0):!1};e.promote=function(b){var a=this.children.indexOf(b);return 0<a?(this.children[a]=this.children[a-1],this.children[a-1]=b,!0):!1};e.demote=function(b){var a=this.children.indexOf(b);return-1!==a&&a<this.children.length-1?(this.children[a]=this.children[a+1],this.children[a+1]=b,!0):!1};e.getSize=
+function(){return{x:q,y:l}};return e};besogo.loadSgf=function(q,l){function m(c,g){var f;for(f=0;f<c.props.length;f++){var k=g;var d=c.props[f];switch(d.id){case "B":d=w(d.values[0]);k.playMove(d.x,d.y,-1,!0);break;case "W":d=w(d.values[0]);k.playMove(d.x,d.y,1,!0);break;case "AB":t(d.values,k,"placeSetup",-1);break;case "AW":t(d.values,k,"placeSetup",1);break;case "AE":t(d.values,k,"placeSetup",0);break;case "CR":t(d.values,k,"addMarkup",1);break;case "SQ":t(d.values,k,"addMarkup",2);break;case "TR":t(d.values,k,"addMarkup",3);break;
+case "M":case "MA":t(d.values,k,"addMarkup",4);break;case "SL":t(d.values,k,"addMarkup",5);break;case "L":case "LB":t(d.values,k,"addMarkup","label");break;case "C":k.comment=k.comment?k.comment+("n"+d.values.join().trim()):d.values.join().trim()}}for(f=0;f<c.children.length;f++)k=g.makeChild(),g.addChild(k),m(c.children[f],k)}function t(c,g,f,k){var d,p;for(d=0;d<c.length;d++){var h=w(c[d].slice(0,2));if("label"===k){var u=c[d].slice(3).replace(/n/g," ");g[f](h.x,h.y,u)}else if(":"===c[d].charAt(2)){var v=
+w(c[d].slice(3));if(v.x===h.x&&v.y===h.y)g[f](h.x,h.y,k);else if(v.x<h.x||v.y<h.y)g[f](h.x,h.y,k),g[f](v.x,v.y,k);else for(u=h.x;u<=v.x;u++)for(p=h.y;p<=v.y;p++)g[f](u,p,k)}else g[f](h.x,h.y,k)}}function w(c){return c.match(/^[A-Za-z]{2}$/)?{x:e(c.charAt(0)),y:e(c.charAt(1))}:{x:0,y:0}}function e(c){return c.match(/[A-Z]/)?c.charCodeAt(0)-65+27:c.charCodeAt(0)-97+1}var b={x:19,y:19};(function(c){var g="PB BR BT PW WR WT HA KM RU TM OT DT EV GN PC RO GC ON RE AN CP SO US".split(" "),f={},k;for(k=0;k<
+c.props.length;k++){var d=c.props[k].id;var p=c.props[k].values.join().trim();"SZ"===d?b=besogo.parseSize(p):"ST"===d?l.setVariantStyle(+p):-1!==g.indexOf(d)&&("GC"!==d&&(p=p.replace(/n/g," ")),p&&(f[d]=p))}l.setGameInfo(f)})(q);var a=besogo.makeGameRoot(b.x,b.y);m(q,a);l.loadRoot(a)};besogo.makeNamesPanel=function(q,l){function m(k){var d=0;if(k.gameInfo){var p=(k.gameInfo.PW||"White")+" ("+(k.gameInfo.WR||"?")+")"+(k.gameInfo.WT?" "+k.gameInfo.WT:"");p=document.createTextNode(p);e.replaceChild(p,a);a=p;p=(k.gameInfo.PB||"Black")+" ("+(k.gameInfo.BR||"?")+")"+(k.gameInfo.BT?" "+k.gameInfo.BT:"");p=document.createTextNode(p);b.replaceChild(p,c);c=p}if(k.navChange||k.stoneChange)k=l.getCurrent(),k.move&&0===k.move.x&&0===k.move.y&&(d=k.move.color),t(g,(1===d?"Passed ":"")+k.whiteCaps),
+t(f,k.blackCaps+(-1===d?" Passed":""))}function t(k,d){for(d=document.createTextNode(d);k.firstChild;)k.removeChild(k.firstChild);k.appendChild(d)}var w=document.createElement("div"),e=document.createElement("div"),b=document.createElement("div"),a=document.createTextNode(""),c=document.createTextNode(""),g=document.createElement("span"),f=document.createElement("span");w.className="besogo-playerInfo";e.className="besogo-whiteInfo";b.className="besogo-blackInfo";g.className="besogo-whiteCaps";g.title=
+"White captures";f.className="besogo-blackCaps";f.title="Black captures";e.appendChild(a);e.appendChild(g);b.appendChild(c);b.appendChild(f);w.appendChild(e);w.appendChild(b);q.appendChild(w);l.addListener(m);m({navChange:!0,gameInfo:l.getGameInfo()})};besogo.parseSgf=function(q){function l(g){throw{name:"Syntax Error",message:g,at:a,text:q};}function m(g){g&&g!==c&&l("Expected '"+g+"' instead of '"+c+"'");a++;return c=q.charAt(a)}function t(){for(;c&&" ">=c;)m()}function w(){return"n"===c?("r"===q.charAt(a+1)&&m(),!0):"r"===c?("n"===q.charAt(a+1)&&m(),!0):!1}function e(){var g;m("(");t();";"!==c&&l("Sub-tree missing root");var f=b();t();for(g=f;";"===c;){var k=b();g.children.push(k);g=k;t()}for(;"("===c;)k=e(),g.children.push(k),t();m(")");
+return f}function b(){var g,f={props:[],children:[]};m(";");for(t();c&&";"!==c&&"("!==c&&")"!==c;){for(g={id:"",values:[]};c&&/[A-Za-z]/.test(c);)/[A-Z]/.test(c)&&(g.id+=c),m();g.id||l("Missing property ID");for(t();"["===c;){var k=g.values,d=k.push,p="";for(m("[");c&&"]"!==c;)"\"===c?(m("\"),w()||(p=" ">=c?p+" ":p+c)):p=w()?p+"n":" ">=c?p+" ":p+c,m();m("]");d.call(k,p);t()}0===g.values.length&&l("Missing property values");f.props.push(g);t()}return f}for(var a=0,c=q.charAt(a);c&&"("!==c;)m();
+return e()};besogo.composeSgf=function(q){function l(b){var a=";",c=b.children;if(!b.parent){var g="FF[4]GM[1]CA[UTF-8]AP[besogo:"+besogo.VERSION+"]",f=b.getSize().x,k=b.getSize().y,d=q.getGameInfo(),p=!1;g=(f===k?g+("SZ["+f+"]"):g+("SZ["+f+":"+k+"]"))+("ST["+q.getVariantStyle()+"]n");for(h in d)d.hasOwnProperty(h)&&d[h]&&(g+=h+"["+t(d[h])+"]",p=!0);a+=g+(p?"n":"")}var h=a;a="";if("move"===b.getType())f=b.move,a+=1===f.color?"W":"B",a+="["+w(f.x,f.y)+"]";else if("setup"===b.getType()){g={AB:[],AW:[],AE:[]};
+for(k=1;k<=b.getSize().x;k++)for(d=1;d<=b.getSize().y;d++)(f=b.getSetup(k,d))&&g[f].push({x:k,y:d});a+=m(g)}g={CR:[],SQ:[],TR:[],MA:[],SL:[],LB:[]};for(k=1;k<=b.getSize().x;k++)for(d=1;d<=b.getSize().y;d++)if(f=b.getMarkup(k,d))"string"===typeof f?g.LB.push({x:k,y:d,label:f}):(f=["CR","SQ","TR","MA","SL"][f-1],g[f].push({x:k,y:d}));a+=m(g);b.comment&&(a=a+(a?"n":"")+("C["+t(b.comment)+"]"));a=h+a;if(1===c.length)a+="n"+l(c[0]);else if(1<c.length)for(b=0;b<c.length;b++)a+="n("+l(c[b])+")";return a}
+function m(b){var a="",c,g;for(c in b)if(b.hasOwnProperty(c)){var f=b[c];if(0<f.length)for(a+=c,g=0;g<f.length;g++)a+="["+w(f[g].x,f[g].y),f[g].label&&(a+=":"+t(f[g].label)),a+="]"}return a}function t(b){b=b.replace(/\/g,"\\");return b.replace(/]/g,"\]")}function w(b,a){return 0===b||0===a?"":e(b)+e(a)}function e(b){return 26<b?String.fromCharCode(65+b-27):String.fromCharCode(97+b-1)}return"("+l(q.getRoot())+")"};(function(){besogo.RED="#be0119";besogo.LRED="#ff474c";besogo.BLUE="#0165fc";besogo.PURP="#9a0eea";besogo.GREY="#929591";besogo.GOLD="#dbb40c";besogo.TURQ="#06c2ac";besogo.BLACK_STONES=4;besogo.WHITE_STONES=11;besogo.svgEl=function(q,l){var m;q=document.createElementNS("http://www.w3.org/2000/svg",q);for(m in l||{})l.hasOwnProperty(m)&&q.setAttribute(m,l[m]);return q};besogo.svgShadowGroup=function(){var q=besogo.svgEl("g"),l=besogo.svgEl("filter",{id:"blur"}),m=besogo.svgEl("feGaussianBlur",{in:"SourceGraphic",
+stdDeviation:"2"});l.appendChild(m);q.appendChild(l);return q};besogo.svgShadow=function(q,l){return besogo.svgEl("circle",{cx:q,cy:l,r:43,stroke:"none",fill:"black",opacity:.32,filter:"url(#blur)"})};besogo.realStone=function(q,l,m,t){m=0>m?"black"+t%besogo.BLACK_STONES:"white"+t%besogo.WHITE_STONES;m="/besogo/img/"+m+".png";q=besogo.svgEl("image",{x:q-44,y:l-44,height:88,width:88});q.setAttributeNS("http://www.w3.org/1999/xlink","href",m);return q};besogo.svgStone=function(q,l,m){var t="besogo-svg-greyStone";
+-1===m?t="besogo-svg-blackStone":1===m&&(t="besogo-svg-whiteStone");return besogo.svgEl("circle",{cx:q,cy:l,r:42,"class":t})};besogo.svgCircle=function(q,l,m){return besogo.svgEl("circle",{cx:q,cy:l,r:27,stroke:m,"stroke-width":8,fill:"none"})};besogo.svgSquare=function(q,l,m){return besogo.svgEl("rect",{x:q-23,y:l-23,width:46,height:46,stroke:m,"stroke-width":8,fill:"none"})};besogo.svgTriangle=function(q,l,m){return besogo.svgEl("polygon",{points:""+q+","+(l-30)+" "+(q-26)+","+(l+15)+" "+(q+26)+
+","+(l+15),stroke:m,"stroke-width":8,fill:"none"})};besogo.svgCross=function(q,l,m){return besogo.svgEl("path",{d:"m"+(q-24)+","+(l-24)+"l48,48m0,-48l-48,48",stroke:m,"stroke-width":8,fill:"none"})};besogo.svgPlus=function(q,l,m){return besogo.svgEl("path",{d:"m"+q+","+(l-28)+"v56m-28,-28h56",stroke:m,"stroke-width":8,fill:"none"})};besogo.svgBlock=function(q,l,m){return besogo.svgEl("rect",{x:q-18,y:l-18,width:36,height:36,stroke:"none","stroke-width":8,fill:m})};besogo.svgLabel=function(q,l,m,t){3<
+t.length&&(t=t.slice(0,2)+"u2026");switch(t.length){case 1:var w=72;break;case 2:w=56;break;case 3:w=36}q=besogo.svgEl("text",{x:q,y:l,dy:".65ex","font-size":w,"text-anchor":"middle","font-family":"Helvetica, Arial, sans-serif",fill:m});q.appendChild(document.createTextNode(t));return q}})();besogo.makeToolPanel=function(q,l){function m(g,f){var k=document.createElement("button"),d=besogo.svgEl("svg",{width:"100%",height:"100%",viewBox:"-55 -55 110 110"}),p=besogo.svgEl("rect",{x:-50,y:-50,width:100,height:100,fill:"none","stroke-width":8,stroke:besogo.GOLD,rx:20,ry:20,visibility:"hidden"});q.appendChild(k);k.appendChild(d);k.onclick=function(){"auto"===g&&"auto"===l.getTool()?l.setTool("navOnly"):l.setTool(g)};k.title=f;e[g]=p;d.appendChild(p);return d}function t(g,f,k){var d=document.createElement("input");
+d.type="button";d.value=g;d.title=f;d.onclick=k;q.appendChild(d)}function w(g){var f;g.label&&(c.value=g.label);if(g.tool)for(f in e)e.hasOwnProperty(f)&&(g.tool===f?e[f].setAttribute("visibility","visible"):e[f].setAttribute("visibility","hidden"))}var e={};var b=m("auto","Auto-play/navigatencrtl+click to force ko, suicide, overwritenshift+click to jump to move");b.appendChild(function(g,f){var k=besogo.svgEl("g");k.appendChild(besogo.svgEl("path",{d:"m"+g+","+(f-44)+" a44 44 0 0 1 0,88z",stroke:"none",
+fill:"black"}));k.appendChild(besogo.svgEl("path",{d:"m"+g+","+(f+44)+"a44 44 0 0 1 0,-88a22 22 0 0 1 0,44z",stroke:"none",fill:"white"}));k.appendChild(besogo.svgEl("circle",{cx:g,cy:f+22,r:22,stroke:"none",fill:"black"}));return k}(0,0));b=m("addB","Set blacknctrl+click to play");var a=besogo.svgEl("g");a.appendChild(besogo.svgStone(0,0,-1));b.appendChild(a);b=m("addW","Set whitenctrl+click to play");a=besogo.svgEl("g");a.appendChild(besogo.svgStone(0,0,1));b.appendChild(a);b=m("addE","Set empty point");
+a=besogo.svgEl("g");a.appendChild(besogo.svgStone(0,0));a.appendChild(besogo.svgCross(0,0,besogo.RED));b.appendChild(a);b=m("circle","Circle");b.appendChild(besogo.svgCircle(0,0,"black"));b=m("square","Square");b.appendChild(besogo.svgSquare(0,0,"black"));b=m("triangle","Triangle");b.appendChild(besogo.svgTriangle(0,0,"black"));b=m("cross","Cross");b.appendChild(besogo.svgCross(0,0,"black"));b=m("block","Block");b.appendChild(besogo.svgBlock(0,0,"black"));b=m("clrMark","Clear mark");a=besogo.svgEl("g");
+a.appendChild(besogo.svgTriangle(0,0,besogo.GREY));a.appendChild(besogo.svgCross(0,0,besogo.RED));b.appendChild(a);b=m("label","Label");b.appendChild(besogo.svgLabel(0,0,"black","A1"));var c=document.createElement("input");c.type="text";c.title="Next label";c.onblur=function(){l.setLabel(c.value)};c.addEventListener("keydown",function(g){g=g||window.event;g.stopPropagation()});q.appendChild(c);t("Pass","Pass move",function(){var g=l.getTool();"navOnly"!==g&&"auto"!==g&&"playB"!==g&&"playW"!==g&&l.setTool("auto");
+l.click(0,0,!1)});t("Raise","Raise variation",function(){l.promote()});t("Lower","Lower variation",function(){l.demote()});t("Cut","Remove branch",function(){l.cutCurrent()});l.addListener(w);w({label:l.getLabel(),tool:l.getTool()})};besogo.makeTreePanel=function(q,l){function m(h){var u=q.clientWidth,v=q.clientHeight,r=q.scrollTop,B=q.scrollLeft,D=.25*(h.getAttribute("x")-5),n=.25*(h.getAttribute("y")-5);D<B?q.scrollLeft=D:D+30>B+u&&(q.scrollLeft=D+30-u);n<r?q.scrollTop=n:n+30>r+v&&(q.scrollTop=n+30-v);h.setAttribute("opacity",1);h.onmouseover=null;h.onmouseout=null;d.appendChild(h);p=h}function t(h){h.setAttribute("opacity",0);h.onmouseover=function(){h.setAttribute("opacity",.5)};h.onmouseout=function(){h.setAttribute("opacity",
+0)};f.appendChild(h)}function w(){var h=l.getCurrent(),u=l.getRoot(),v=[],r=f,B=besogo.svgEl("rect",{height:"100%",width:"100%","class":"besogo-svg-board besogo-svg-backer"});f=besogo.svgEl("svg");d=besogo.svgEl("g");k=besogo.svgEl("g");f.appendChild(B);f.appendChild(d);f.appendChild(k);u=e(u,0,0,v);k.appendChild(g(u,"black"));u=120*v.length;v=120*Math.max.apply(Math,v);f.setAttribute("viewBox","0 0 "+u+" "+v);f.setAttribute("height",.25*v);f.setAttribute("width",.25*u);r?q.replaceChild(f,r):q.appendChild(f);
+m(h.navTreeMarker)}function e(h,u,v,r){var B=h.children,D;if(0===B.length)var n="m"+(120*u+60)+","+(120*v+60);else{var z=r[u+1]||0;z=z<v?v:z;v<z-1&&(v=z-1);n=e(B[0],u+1,z,r)+c(u,v,r);for(D=1;D<B.length;D++)z=r[u+1],z=e(B[D],u+1,z,r)+c(u,v,r,z-1),k.appendChild(g(z,"black"))}f.appendChild(b(h,u,v));a(h,u,v);r[u]=v+1;return n}function b(h,u,v){switch(h.getType()){case "move":var r=h.move.color;var B=besogo.svgEl("g");B.appendChild(besogo.svgStone(120*u+60,120*v+60,r));B.appendChild(besogo.svgLabel(120*
+u+60,120*v+60,-1===r?"white":"black",""+h.moveNumber));break;case "setup":B=besogo.svgEl("g");B.appendChild(besogo.svgStone(120*u+60,120*v+60));B.appendChild(besogo.svgPlus(120*u+60,120*v+60,besogo.RED));break;default:B=besogo.svgStone(120*u+60,120*v+60)}h.navTreeIcon=B;h.navTreeX=u;h.navTreeY=v;return B}function a(h,u,v){u=besogo.svgEl("rect",{x:120*u+60-55,y:120*v+60-55,width:110,height:110,fill:besogo.TURQ});u.onclick=function(){l.setCurrent(h)};h.navTreeMarker=u;t(u)}function c(h,u,v,r){h=v[h+
+1]-1;return h===u?"h-120":h===u+1?"l-120,-120":r&&r!==u?"l-60,-60v-"+120*(h-r):"l-60,-60v-"+120*(h-u-1)+"l-60,-60"}function g(h,u){return besogo.svgEl("path",{d:h,stroke:u,"stroke-width":8,fill:"none"})}var f,k,d,p;w();l.addListener(function(h){if(h.treeChange)w();else if(h.navChange)h=l.getCurrent(),t(p),m(h.navTreeMarker);else if(h.stoneChange){var u=l.getCurrent();h=u.navTreeIcon;u=b(u,u.navTreeX,u.navTreeY);f.replaceChild(u,h)}})};
diff --git a/static/besogo/css/besogo.css b/static/besogo/css/besogo.css
@@ -0,0 +1,146 @@
+.besogo-container {
+ outline: none;
+ display: flex;
+ background: #d0fefe;
+ color: black;
+}
+
+.besogo-container * {
+ box-sizing: border-box;
+}
+
+.besogo-container button {
+ height: 30px;
+ width: 30px;
+ padding: 0px;
+ background: #d8dcd6;
+ border-color: #ffffff #e6e6e6 #e6e6e6 #ffffff;
+}
+
+.besogo-container input {
+ font-size: 12pt;
+
+}
+
+.besogo-container input[type='button'] {
+ background: #d8dcd6;
+ border-color: #ffffff #e6e6e6 #e6e6e6 #ffffff;
+}
+
+.besogo-container input[type='text'] {
+ width: 30px;
+}
+
+.besogo-container svg { /* Prevent text selection within SVG */
+ -webkit-touch-callout: none; /* iOS Safari */
+ -webkit-user-select: none; /* Chrome/Safari/Opera */
+ -moz-user-select: none; /* Firefox */
+ -ms-user-select: none; /* Internet Explorer/Edge */
+ user-select: none;
+}
+
+.besogo-panels {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ padding: 0px 5px;
+}
+
+.besogo-panels > * {
+ margin: 3px 0px;
+}
+
+.besogo-control {
+ display: flex;
+ align-items: center;
+ flex-wrap: wrap;
+ justify-content: space-around;
+ width: 100%;
+
+ flex: 0 0 auto;
+}
+
+.besogo-names {
+ flex: 0 0 auto;
+ width: 100%;
+}
+
+.besogo-playerInfo {
+ display: flex;
+ font-family: Tahoma, Geneva, sans-serif;
+ white-space: pre-wrap;
+}
+
+.besogo-blackInfo {
+ flex: 50%;
+ color: white;
+ background: black;
+ text-align: right;
+ padding: 5px;
+}
+
+.besogo-whiteInfo {
+ flex: 50%;
+ color: black;
+ background: white;
+ text-align: left;
+ padding: 5px;
+}
+
+.besogo-blackCaps {
+ float: left;
+}
+
+.besogo-whiteCaps {
+ float: right;
+}
+
+.besogo-comment {
+ font-family: Georgia, serif;
+ font-size: 12pt;
+ white-space: pre-wrap;
+
+
+ overflow: auto;
+ flex: 1 1 60%;
+ width: 100%;
+}
+
+.besogo-comment input[type='button'] {
+ float: right;
+}
+
+.besogo-comment textarea {
+ height: 100%;
+ width: 100%;
+}
+
+.besogo-gameInfo {
+ padding: 5px;
+ border-collapse: collapse;
+}
+
+.besogo-gameInfo td, tr {
+ border: 1px solid black;
+ padding: 3px;
+}
+
+.besogo-tool {
+ display: flex;
+ align-items: center;
+ flex-wrap: wrap;
+ justify-content: space-around;
+ width: 100%;
+
+ flex: 0 0 auto;
+}
+
+.besogo-tree {
+ overflow: auto;
+ flex: 1 1 40%;
+ width: 100%;
+}
+
+.besogo-file {
+ flex: 0 0 auto;
+}
diff --git a/static/besogo/css/board-flat.css b/static/besogo/css/board-flat.css
@@ -0,0 +1,34 @@
+/* Flat board theme */
+
+.besogo-svg-board {
+ fill: #e0bb6c;
+}
+
+.besogo-svg-lines {
+ stroke: #343837;
+ stroke-width: 3;
+ fill: none;
+}
+
+.besogo-svg-hoshi {
+ stroke: #1b2431;
+ stroke-width: 12;
+}
+
+.besogo-svg-blackStone {
+ fill: #252525;
+ stroke: #252525;
+ stroke-width: 4;
+}
+
+.besogo-svg-whiteStone {
+ fill: #eeeeee;
+ stroke: #eeeeee;
+ stroke-width: 4;
+}
+
+.besogo-svg-greyStone {
+ fill: #929591;
+ stroke: #929591;
+ stroke-width: 4;
+}