{"id":3842,"date":"2016-04-30T16:27:16","date_gmt":"2016-04-30T07:27:16","guid":{"rendered":"http:\/\/njet.oops.jp\/wordpress\/?p=3842"},"modified":"2016-04-30T16:27:16","modified_gmt":"2016-04-30T07:27:16","slug":"%e5%9b%b2%e7%a2%81%e6%a3%8b%e8%ad%9c%e5%86%8d%e7%94%9f%e3%83%97%e3%83%a9%e3%82%b0%e3%82%a4%e3%83%b3maxigos%e3%82%92%e8%a9%a6%e3%81%99","status":"publish","type":"post","link":"https:\/\/njet.oops.jp\/wordpress\/2016\/04\/30\/%e5%9b%b2%e7%a2%81%e6%a3%8b%e8%ad%9c%e5%86%8d%e7%94%9f%e3%83%97%e3%83%a9%e3%82%b0%e3%82%a4%e3%83%b3maxigos%e3%82%92%e8%a9%a6%e3%81%99\/","title":{"rendered":"\u56f2\u7881\u68cb\u8b5c\u518d\u751f\u30d7\u30e9\u30b0\u30a4\u30f3MaxiGos\u3092\u8a66\u3059"},"content":{"rendered":"<script charset=\"UTF-8\">\n\/\/ maxiGos-en v6.51 Copyright 1998-2026 Francois Mizessyn, BSD license (see license.txt)\n\n\/\/ begin of localization\nif (typeof mxG=='undefined') mxG={};\nif (typeof mxG.L=='undefined') mxG.L=\"en\";\n\/\/ end of localization\n\n\/\/ maxiGos v6.51 > mgos_lib.js Copyright 2010-2016 Francois Mizessyn, BSD license (see license.txt)\n\n\/\/ only one global name: mxG\nif (typeof mxG=='undefined') mxG={};\n\nif (!mxG.V){\nString.prototype.c2n=function(k){var n=this.charCodeAt(k);return n-((n<97)?38:96);};\nString.prototype.ucFirst=function(){return this.charAt(0).toUpperCase()+this.slice(1);}\nString.prototype.lcFirst=function(){return this.charAt(0).toLowerCase()+this.slice(1);}\nmxG.D=[];\nmxG.K=0;\nmxG.S=[];\nmxG.V=\"6.51\";\nif (typeof mxG.L=='undefined') mxG.L=\"fr\";\nif (typeof mxG.Z=='undefined') mxG.Z=[];\nmxG.L_=mxG.L.replace(\"-\",\"_\");\nmxG.IsArray=function(a) {return a.constructor===Array;};\nmxG.GetStyle=function(e,p){return window.getComputedStyle?window.getComputedStyle(e,null)[p]:\"\";};\nmxG.GetPxStyle=function(e,p){var r=parseFloat(mxG.GetStyle(e,p));return isNaN(r)?0:r;};\nmxG.GetPxrStyle=function(e,p){return Math.round(mxG.GetPxStyle(e,p))};\nmxG.GetDir=function()\n{\n\tvar s=document.getElementsByTagName('script'),p=s[s.length-1].src.split('?')[0];\n\treturn p.split(\"\/\").slice(0,-1).join(\"\/\")+\"\/\";\n};\nmxG.AddCss=function(s)\n{\n\tvar k,km=mxG.S.length,e;\n\tfor (k=0;k<km;k++) if (s==mxG.S[k]) return;\n\tmxG.S.push(s);\n\te=document.createElement('link');\n\te.setAttribute('rel','stylesheet');\n\te.setAttribute('type','text\/css');\n\te.setAttribute('href',s);\n\tdocument.getElementsByTagName('head')[0].appendChild(e);\n};\nmxG.AddCssRule=function(css)\n{\n\tvar s;\n\tdocument.getElementsByTagName('head')[0].appendChild(document.createElement(\"style\"));\n\ts=document.styleSheets[document.styleSheets.length-1];\n\ts.insertRule(css,0);\n};\nmxG.Color2Rgba=function(c)\n{\n\tvar cn,cx;\n\tcn=document.createElement(\"canvas\");\n\tcn.width=1;\n\tcn.height=1;\n\tcx=cn.getContext(\"2d\");\n\tcx.fillStyle=c;\n\tcx.fillRect(0,0,1,1);\n\treturn cx.getImageData(0,0,1,1).data;\n};\nmxG.GetMClick=function(ev)\n{\n\tvar box=this.getBoundingClientRect();\n\treturn {x:ev.clientX-box.left,y:ev.clientY-box.top};\n};\nmxG.GetKCode=function(ev)\n{\n\tvar c;\n\tif (!ev) ev=window.event;\n\tif (ev.altKey||ev.ctrlKey||ev.metaKey) return 0;\n\tc=ev.keyCode;\n\tif (ev.charCode&&(c==0)) c=ev.charCode;\n\treturn c;\n};\nmxG.CreateUnselectable=function()\n{\n\tif (!mxG.Unselectable)\n\t{\n\t\tvar s=document.createElement('style'),c='',k,a=['-moz-','-webkit-','-ms-',''];\n\t\tfor (k=0;k<4;k++) c+=(a[k]+'user-select:none;');\n\t\ts.type='text\/css';\n\t\ts.innerHTML='.mxUnselectable {'+c+'}';\n\t\tdocument.getElementsByTagName('head')[0].appendChild(s);\n\t\tmxG.Unselectable=1;\n\t}\n};\nmxG.CanCn=function(){return !!document.createElement('canvas').getContext;};\nmxG.CanToDataURL=function()\n{\n\tvar c=document.createElement(\"canvas\"),d=c.toDataURL(\"image\/png\");\n\treturn (d.indexOf(\"data:image\/png\")==0);\n};\nmxG.CanOpen=function()\n{var r;return !(typeof FileReader=='undefined')&&(r=new FileReader())&&(r.readAsText);};\nmxG.IsMacSafari=function()\n{\n\tvar u=navigator.userAgent.toLowerCase();\n\treturn (u.indexOf('safari')!=-1)&&(u.indexOf('macintosh')!=-1)&&!(u.indexOf('chrome')>-1);\n};\nmxG.IsAndroid=function(){return (navigator.userAgent.toLowerCase().indexOf(\"android\")>-1);};\nmxG.IsIOS=function(){return navigator.userAgent.match(\/(iPad|iPhone|iPod)\/g)?1:0;};\nmxG.hasVerticalScrollBar=function()\n{\n\tvar w=window,d=w.document,c=d.compatMode;\n\tr=c&&\/CSS\/.test(c)?d.documentElement:d.body;\n\tif (typeof w.innerWidth=='number') return w.innerWidth>r.clientWidth;\n\telse return r.scrollWidth>r.clientWidth;\n};\nmxG.verticalScrollBarWidth=function()\n{\n\tvar w=window,d=w.document,b=d.body,r=0,t,s;\n\tif (b)\n\t{\n\t\tt=d.createElement('div');\n\t\ts='position:absolute;overflow:scroll;top:-100px;left:-100px;width:100px;height:100px;';\n\t\tt.style.cssText=s;\n\t\tb.insertBefore(t,b.firstChild);\n\t\tr=t.offsetWidth-t.clientWidth;\n\t\tb.removeChild(t);\n\t}\n\treturn r;\n};\nmxG.fileExist=function(f)\n{\n\tvar xhr=new XMLHttpRequest();\n\txhr.z=0;\n\txhr.onreadystatechange=function(){if ((this.readyState==4)&&(this.status==200)) xhr.z=1;};\n\txhr.open(\"GET\",f,false);\n\txhr.send(null);\n\treturn xhr.z;\n};\nmxG.tag2special=function(s)\n{\n    return (s+'').replace(\/&\/g,'&amp;').replace(\/<\/g,'&lt;').replace(\/>\/g,'&gt;');\n};\n}\n\n\n\/\/ maxiGos v6.42 > mgos_rls.js Copyright 1998-2014 Francois Mizessyn, BSD license (see license.txt)\r\n\/\/ go rules manager\r\n\r\nif (!mxG.R){\r\n\r\nmxG.R=function()\r\n{\r\n\tthis.act=[\"\"]; \/\/ action history (\"\" as \"Play\" or \"A\" as \"Add\")\r\n\tthis.nat=[\"E\"]; \/\/ nature history (\"B\" as \"Black\", \"W\" as \"White\" or \"E\" as \"Empty\")\r\n\tthis.x=[0]; \/\/ x coordinate of action\r\n\tthis.y=[0]; \/\/ y coordinate of action\r\n\tthis.o=[0]; \/\/ 0 if never taken, m if taken by m \r\n};\r\n\r\nmxG.R.prototype.inGoban=function(x,y)\r\n{\r\n\treturn (x>=1)&&(y>=1)&&(x<=this.DX)&&(y<=this.DY);\r\n};\r\n\r\nmxG.R.prototype.init=function(DX,DY)\r\n{\r\n\tvar i,j;\r\n\tthis.play=0; \/\/ action counter\r\n\tthis.setup=0; \/\/ last setup action number\r\n\tthis.DX=DX; \/\/ number of column (19 for classic goban)\r\n\tthis.DY=DY; \/\/ number of row (19 for classic goban)\r\n\tthis.ban=[]; \/\/ goban (each point contains last action done on this point)\r\n\tfor (i=1;i<=this.DX;i++) \/\/ prefer that indices start at 1 for lisibility\r\n\t{\r\n\t\tthis.ban[i]=[];\r\n\t\tfor (j=1;j<=this.DY;j++) this.ban[i][j]=0;\r\n\t}\r\n\tthis.prisoners={B:[0],W:[0]}; \/\/ number of prisoner taken by black and white\r\n};\r\n\r\nmxG.R.prototype.lib=function(nat,x,y)\r\n{\r\n\t\/\/ return 1 if (x,y) is a liberty, or is nat with liberties\r\n\tvar k,km;\r\n\tif (!this.inGoban(x,y)) return 0;\r\n\tif (this.nat[this.ban[x][y]]==\"E\") return 1;\r\n\tif (this.nat[this.ban[x][y]]!=nat) return 0;\r\n\tkm=this.s.length;\r\n\tfor (k=0;k<km;k++) if ((this.s[k].x==x)&&(this.s[k].y==y)) return 0;\r\n\tthis.s[km]={x:x,y:y};\r\n\tif (this.lib(nat,x,y-1)||this.lib(nat,x+1,y)||this.lib(nat,x,y+1)||this.lib(nat,x-1,y)) return 1;\r\n\treturn 0;\r\n};\r\n\r\nmxG.R.prototype.capture=function(nat,x,y)\r\n{\r\n\t\/\/ capture nat stones\r\n\tthis.s=[];\r\n\tif (this.lib(nat,x,y)) return 0;\r\n\tvar numOfPrisoner=this.s.length,pt;\r\n\twhile (this.s.length)\r\n\t{\r\n\t\tpt=this.s.pop();\r\n\t\tthis.o[this.ban[pt.x][pt.y]]=this.play;\r\n\t\tthis.ban[pt.x][pt.y]=0;\r\n\t}\r\n\treturn numOfPrisoner;\r\n};\r\n\r\nmxG.R.prototype.place=function(nat,x,y)\r\n{\r\n\t\/\/ works even if the move is not valid\r\n\t\/\/ nat can be B, W, AB, AW, or AE\r\n\t\/\/ pNat: player nat, oNat: opponent nat\r\n\tthis.play++;\r\n\tvar act=((nat.length>1)?\"A\":\"\"),pNat=nat.substr(nat.length-1,1),oNat=((pNat==\"B\")?\"W\":((pNat==\"W\")?\"B\":\"E\")),prisoners,m=this.play;\r\n\tthis.act[m]=act;\r\n\tthis.nat[m]=pNat;\r\n\tthis.prisoners.B[m]=this.prisoners.B[m-1];\r\n\tthis.prisoners.W[m]=this.prisoners.W[m-1];\r\n\tthis.o[m]=0;\r\n\tif (this.inGoban(x,y))\r\n\t{\r\n\t\tthis.x[m]=x;\r\n\t\tthis.y[m]=y;\r\n\t\tif (act!=\"A\") \/\/ B or W\r\n\t\t{\r\n\t\t\tthis.ban[x][y]=m;\r\n\t\t\tprisoners=this.capture(oNat,x-1,y);\r\n\t\t\tprisoners+=this.capture(oNat,x+1,y);\r\n\t\t\tprisoners+=this.capture(oNat,x,y-1);\r\n\t\t\tprisoners+=this.capture(oNat,x,y+1);\r\n\t\t\tif (!prisoners)\r\n\t\t\t{\r\n\t\t\t\tprisoners=this.capture(pNat,x,y); \/\/ suicide\r\n\t\t\t\tthis.prisoners[oNat][m]+=prisoners;\r\n\t\t\t}\r\n\t\t\telse this.prisoners[pNat][m]+=prisoners;\r\n\t\t}\r\n\t\telse \/\/ AB, AW or AE\r\n\t\t{\r\n\t\t\tthis.setup=m;\r\n\t\t\tthis.ban[x][y]=(pNat!=\"E\"?m:0);\r\n\t\t}\r\n\t}\r\n\telse\r\n\t{\r\n\t\tthis.x[m]=0;\r\n\t\tthis.y[m]=0;\r\n\t}\r\n};\r\n\r\nmxG.R.prototype.back=function(play)\r\n{\r\n\tthis.init(this.DX,this.DY);\r\n\tfor (var k=1;k<=play;k++) this.place(this.act[k]+this.nat[k],this.x[k],this.y[k]);\r\n};\r\n\r\nmxG.R.prototype.isOccupied=function(x,y)\r\n{\r\n\treturn this.nat[this.ban[x][y]]!=\"E\";\r\n};\r\n\r\nmxG.R.prototype.isOnlyOne=function(k,nat)\r\n{\r\n\tvar n=1,x=this.x[k],y=this.y[k];\r\n\tif ((x>1)&&(this.nat[this.ban[x-1][y]]==nat)) n++;\r\n\tif ((y>1)&&(this.nat[this.ban[x][y-1]]==nat)) n++;\r\n\tif ((x<this.DX)&&(this.nat[this.ban[x+1][y]]==nat)) n++;\r\n\tif ((y<this.DY)&&(this.nat[this.ban[x][y+1]]==nat)) n++;\r\n\treturn n==1;\r\n};\r\n\r\nmxG.R.prototype.hasOnlyOneLib=function(k)\r\n{\r\n\tvar n=0,x=this.x[k],y=this.y[k];\r\n\tif ((x>1)&&(this.nat[this.ban[x-1][y]]==\"E\")) n++;\r\n\tif ((y>1)&&(this.nat[this.ban[x][y-1]]==\"E\")) n++;\r\n\tif ((x<this.DX)&&(this.nat[this.ban[x+1][y]]==\"E\")) n++;\r\n\tif ((y<this.DY)&&(this.nat[this.ban[x][y+1]]==\"E\")) n++;\r\n\treturn n==1;\r\n};\r\n\r\nmxG.R.prototype.captureOnlyOnePrisoner=function(k,nat)\r\n{\r\n\treturn (this.prisoners[nat][k]-this.prisoners[nat][k-1])==1;\r\n};\r\n\r\nmxG.R.prototype.isKo=function(nat,x,y)\r\n{\r\n\t\/\/ japanese ko only\r\n\tvar m=this.play;\r\n\tif (m<4) return 0;\r\n\t\/\/ pNat:player nat, oNat:opponent nat, nNat:nat of the move before the last, mxNat:last move nat\r\n\tvar pNat=nat.substr(nat.length-1,1),oNat=((pNat==\"B\")?\"W\":((pNat==\"W\")?\"B\":\"E\")),\r\n\t\tnNat=this.nat[m-1],mxNat=this.nat[m],\r\n\t\txpred=this.x[m],ypred=this.y[m];\r\n\treturn (((xpred==(x-1))&&(ypred==y))||((xpred==x)&&(ypred==(y-1)))||((xpred==(x+1))&&(ypred==y))||((xpred==x)&&(ypred==(y+1))))\r\n\t\t\t&&this.isOnlyOne(m,oNat)\r\n\t\t\t&&this.hasOnlyOneLib(m)\r\n\t\t\t&&this.captureOnlyOnePrisoner(m,oNat)\r\n\t\t\t&&(pNat==nNat)\r\n\t\t\t&&(oNat==mxNat);\r\n};\r\n\r\nmxG.R.prototype.canCapture=function(nat,x,y)\r\n{\r\n\tthis.s=[];\r\n\tif (this.lib(nat,x,y)) return 0;\r\n\treturn this.s.length;\r\n};\r\n\r\nmxG.R.prototype.isLib=function(x,y)\r\n{\r\n\treturn this.inGoban(x,y)&&(this.nat[this.ban[x][y]]==\"E\");\r\n};\r\n\r\nmxG.R.prototype.isSuicide=function(nat,x,y)\r\n{\r\n\tvar m=this.play,pNat=nat.substr(nat.length-1,1),oNat=((pNat==\"B\")?\"W\":((pNat==\"W\")?\"B\":\"E\")),\r\n\t\ts=1,exNat=this.nat[m+1],exBan=this.ban[x][y];\r\n\tthis.nat[m+1]=pNat;\r\n\tthis.ban[x][y]=m+1;\r\n\tif (this.isLib(x-1,y)||this.isLib(x,y-1)||this.isLib(x+1,y)||this.isLib(x,y+1)\r\n\t\t||this.canCapture(oNat,x-1,y)||this.canCapture(oNat,x,y-1)\r\n\t\t||this.canCapture(oNat,x+1,y)||this.canCapture(oNat,x,y+1)\r\n\t\t||!this.canCapture(pNat,x,y)) s=0;\r\n\tthis.ban[x][y]=exBan;\r\n\tthis.nat[m+1]=exNat;\r\n\treturn s;\r\n};\r\n\r\nmxG.R.prototype.isValid=function(nat,x,y)\r\n{\r\n\treturn (!x&&!y)||!(this.inGoban(x,y)&&(this.isOccupied(x,y)||this.isKo(nat,x,y)||this.isSuicide(nat,x,y)));\r\n};\r\n\r\n\/\/ some useful functions\r\nmxG.R.prototype.getBanNum=function(x,y){return this.ban[x][y];};\r\nmxG.R.prototype.getBanNat=function(x,y){return this.nat[this.ban[x][y]];};\r\nmxG.R.prototype.getNat=function(n){return this.nat[n];};\r\nmxG.R.prototype.getX=function(n){return this.x[n];};\r\nmxG.R.prototype.getY=function(n){return this.y[n];};\r\nmxG.R.prototype.getAct=function(n){return this.act[n];};\r\nmxG.R.prototype.getPrisoners=function(nat){return this.prisoners[nat][this.play];};\r\nmxG.R.prototype.getO=function(n){return this.o[n];};\r\n\r\n}\r\n\n\/\/ maxiGos v6.51 > mgos_prs.js Copyright 2013-2016 Francois Mizessyn, BSD license (see license.txt)\n\/\/ sgf parser\n\nif (!mxG.N){\n\n\/\/ mxG.N class (N=Node, P=Property, V=Value)\n\nmxG.N=function(n,p,v)\n{\n\tthis.Kid=[];\n\tthis.P={}; \/\/ P properties are B, W, AB, ...\n\tthis.Dad=n;\n\tthis.Focus=0; \/\/ kid on focus: 0=>no kid, 1=>1st kid, Kid.length=>last kid\n\tif (n) {n.Kid.push(this);if (!n.Focus) n.Focus=1;}\n\tif (p) this.P[p]=[v];\n};\n\nmxG.N.prototype.N=function(p,v){return new mxG.N(this,p,v);};\n\nmxG.N.prototype.KidOnFocus=function(){return this.Focus?this.Kid[this.Focus-1]:0;};\n\nmxG.N.prototype.TakeOff=function(p,k)\n{\n\tif (this.P[p])\n\t{\n\t\tif (k<0) this.P[p].splice(0,this.P[p].length);else this.P[p].splice(k,1);\n\t\tif (!this.P[p].length) delete this.P[p];\n\t}\n};\n\nmxG.N.prototype.Set=function(p,v)\n{\n\tif (typeof(v)==\"object\") this.P[p]=v;\n\telse this.P[p]=[v];\n};\n\nmxG.N.prototype.Clone=function(dad)\n{\n\tvar p,k,bN=new mxG.N(dad,null,null);\n\tfor (p in this.P) if (p.match(\/^[A-Z]+$\/)) bN.P[p]=this.P[p].concat();\n\tfor (k=0;k<this.Kid.length;k++) bN.Kid[k]=this.Kid[k].Clone(bN);\n\tbN.Focus=this.Focus;\n\treturn bN;\n};\n\n}\n\nif (!mxG.P){\n\nmxG.P=function(gos,s)\n{\n\t\/\/ no need to change charset\n\tthis.rN=gos.rN;\n\tthis.coreOnly=gos.sgfLoadCoreOnly;\n\tthis.mainOnly=gos.sgfLoadMainOnly;\n\tthis.parseSgf(s);\n\tif (!this.rN.Focus) this.parseSgf(gos.so);\n\tif (gos.repareSgfOn) gos.repareSgf(gos.rN);\n};\n\nmxG.P.prototype.keep=function(a,p,v)\n{\n\tif (this.coreOnly&&((a==\"N\")||(a==\"P\")||(a==\"V\")))\n\t\treturn (p==\"B\")||(p==\"W\")||(p==\"AB\")||(p==\"AW\")||(p==\"AE\")\n\t\t\t ||(p==\"FF\")||(p==\"CA\")||(p==\"GM\")||(p==\"SZ\")||(p==\"EV\")||(p==\"RO\")||(p==\"DT\")||(p==\"PC\")\n\t\t\t ||(p==\"PW\")||(p==\"WR\")||(p==\"WT\")||(p==\"PB\")||(p==\"BR\")||(p==\"BT\")\n\t\t\t ||(p==\"RU\")||(p==\"TM\")||(p==\"OT\")||(p==\"HA\")||(p==\"KM\")||(p==\"RE\")||(p==\"VW\");\n\treturn 1;\n};\n\nmxG.P.prototype.out=function(a,p,v)\n{\n\tif (this.keep(a,p,v))\n\t\tswitch(a)\n\t\t{\n\t\t\tcase \"N\":this.nN=this.nN.N(p,v);break;\n\t\t\tcase \"P\":this.nN.P[p]=[v];break;\n\t\t\tcase \"V\":this.nN.P[p].push(v);break;\n\t\t\tcase \"v=\":this.nN=this.v[this.v.length-1];break;\n\t\t\tcase \"v+\":this.v.push(this.nN);break;\n\t\t\tcase \"v-\":this.v.pop();break;\n\t\t}\n};\n\nmxG.P.prototype.clean=function(s)\n{\n\tvar r=s;\n\t\/\/ odd number of \\ before \\n or \\r => sgf soft break\n\t\/\/ remove one \\ and following \\n\\r, \\r\\n, \\n or \\r\n\tr=r.replace(\/([^\\\\])((\\\\\\\\)*)\\\\((\\n\\r)|(\\r\\n)|\\r|\\n)\/g,'$1$2');\n\tr=r.replace(\/^((\\\\\\\\)*)\\\\((\\n\\r)|(\\r\\n)|\\r|\\n)\/g,'$1');\n\t\/\/ remove \\ preceded by even number of \\\n\tr=r.replace(\/([^\\\\])((\\\\\\\\)*)\\\\\/g,'$1$2');\n\tr=r.replace(\/^((\\\\\\\\)*)\\\\\/g,'$1');\n\t\/\/ remove \\ preceded by \\\n\tr=r.replace(\/\\\\\\\\\/g,'\\\\');\n\t\/\/ replace \\n\\r, \\r\\n, and \\r by \\n\n\tr=r.replace(\/(\\n\\r)|(\\r\\n)|\\r\/g,\"\\n\");\n\t\/\/ strip html tags\n    \/\/ r=r.replace(\/<\\\/?\\w(?:[^\"'>]|\"[^\"]*\"|'[^']*')*>\/gmi,'');\n\treturn r;\n};\n\nmxG.P.prototype.parseValue=function(p,K,c)\n{\n\tvar v=\"\",a;\n\tK++; \/\/ by-pass '['\n\twhile ((K<this.l)&&((a=this.s.charAt(K))!=']'))\n\t{\n\t\tif (a=='\\\\') {v+=a;K++;a=this.s.charAt(K);}\n\t\tif (K<this.l) v+=a;\n\t\tK++;\n\t}\n\tv=this.clean(v);\n\t\/\/ if (((p==\"B\")||(p==\"W\"))&&(v==\"tt\")) v=\"\"; \/\/ cannot do it if goban size is larger than 19x19\n\tif (p==\"RE\") {a=v.slice(0,1);if ((a==\"V\")||(a==\"D\")) v=a;}\n\tif (this.nc) {this.nc=0;this.out(\"N\",p,v);}\n\telse if (!c) this.out(\"P\",p,v);\n\telse this.out(\"V\",p,v);\n\tK++; \/\/ by-pass ']'\n\twhile (K<this.l)\n\t{\n\t\ta=this.s.charAt(K);\n\t\tif ((a=='(')||(a==';')||(a==')')||((a>='A')&&(a<='Z'))||(a=='[')) break;else K++;\n\t}\n\treturn K;\n};\n\nmxG.P.prototype.parseProperty=function(K)\n{\n\tvar a,p=\"\",c=0;\n\twhile ((K<this.l)&&((a=this.s.charAt(K))!='['))\n\t{\n\t\tif ((a>='A')&&(a<='Z')) p+=a;\n\t\tK++;\n\t}\n\twhile ((K<this.l)&&(this.s.charAt(K)=='[')) {K=this.parseValue(p,K,c);c++;}\n\treturn K;\n};\n\nmxG.P.prototype.parseNode=function(K)\n{\n\tvar a;\n\tthis.nc=1;\n\twhile (K<this.l)\n\t{\n\t\tswitch(a=this.s.charAt(K))\n\t\t{\n\t\t\tcase '(':\n\t\t\tcase ';':\n\t\t\tcase ')':return K;\n\t\t\tdefault : if ((a>='A')&&(a<='Z')) K=this.parseProperty(K);else K++;\n\t\t}\n\t}\n\treturn K;\n};\n\nmxG.P.prototype.parseVariation=function(K)\n{\n\tvar a=(this.mainOnly?1:0);\n\tif (this.nv) {if (this.v.length) this.out(\"v=\",\"\",\"\");this.nv=0;} else this.out(\"v+\",\"\",\"\");\n\twhile (K<this.l)\n\t\tswitch(this.s.charAt(K))\n\t\t{\n\t\t\tcase '(':if (a) K++;else return K;break;\n\t\t\tcase ';':K++;K=this.parseNode(K);break;\n\t\t\tcase ')':K++;\n\t\t\t\t\t if (this.nv) {if (this.v.length) this.out(\"v-\",\"\",\"\");} else this.nv=1;\n\t\t\t\t\t if (a) return this.l;break;\n\t\t\tdefault :K++;\n\t\t}\n\treturn K;\n};\n\nmxG.P.prototype.parseSgf=function(s)\n{\n\tvar K=0;\n\tthis.rN.Kid=[];\n\tthis.rN.Focus=0;\n\tthis.nN=this.rN;\n\tthis.v=[];\n\tthis.nv=0; \/\/ if 0, 1st node variation\n\tthis.nc=0; \/\/ if 1, create node\n\tthis.s=s;\n\tthis.l=this.s.length;\n\twhile (K<this.l) if (this.s.charAt(K)=='(') {K++;K=this.parseVariation(K);} else K++;\n\twhile (this.v.length) this.out(\"v-\",\"\",\"\");\n};\n\n}\n\n\/\/ maxiGos v6.51 > mgos.js Copyright 2002-2016 Francois Mizessyn, BSD license (see license.txt)\n\nif (!mxG.G){\n\nif (mxG.L==\"fr\")\n{\n\tmxG.Z[\"Require HTML5!\"]=\"Requiert HTML5\u00a0!\";\n\tmxG.Z[\"Loading...\"]=\"Chargement...\";\n}\n\n\/\/ mxG.G class\n\nmxG.G=function(k)\n{\n\tthis.k=k; \/\/ indice of this in mxG.D;\n\tthis.n=\"d\"+k; \/\/ name of this\n\tthis.g=\"mxG.D[\"+k+\"]\"; \/\/ global name of this\n\tthis.sgf=\"\";\n\tthis.b=[]; \/\/ box list\n\tthis.globalBox=\"GlobalBox\"; \/\/ seed for global div class name and id\n\tthis.gBox=\"\"; \/\/ popup box\n\tthis.initMethod=\"last\"; \/\/ \"first\" or \"last\"\n\tthis.refreshTime=1000;\n\tthis.so=\"(;FF[4]CA[UTF-8]GM[1]SZ[19])\";\n\tthis.c=[]; \/\/ component list set from boxes\n\tthis.gor=new mxG.R(); \/\/ rules manager\n\t\/\/ rN is root node, cN is current displayed node\n\t\/\/ rN kids are game tree root nodes (several rN kids means collection)\n\tthis.rN=new mxG.N(null,null,null);\n\tthis.rN.sgf=\"\";\n\tthis.j=document.scripts[document.scripts.length-1]; \/\/ current script HTML element\n\tthis.s=this.j; \/\/ target HTML element where player displays\n\tthis.h=\"\"; \/\/ content to write in target HTML element if (s!=j)\n};\n\nmxG.G.prototype.debug=function(s,m)\n{var e=this.getE(\"DebugDiv\");if (e) {if (m) e.innerHTML+=s;else e.innerHTML=s;}};\nmxG.G.prototype.write=function(s){if (this.s!=this.j) this.h+=s;else document.write(s);};\nmxG.G.prototype.local=function(s){return (mxG.Z[s]!==undefined)?mxG.Z[s]:s;};\nmxG.G.prototype.build=function(x,a)\n{var f=\"build\"+x;if (mxG.Z[f]) return mxG.Z[f](a);if (this[f]) return this[f](a);return a+\"\";};\nmxG.G.prototype.label=function(s,t)\n{return this[t+\"_\"+mxG.L_]?this[t+\"_\"+mxG.L_]:this.local(s);};\n\nmxG.G.prototype.hasC=function(x)\n{\n\tvar b,bm,c,cm;\n\tbm=this.b.length;\n\tfor (b=0;b<bm;b++)\n\t{\n\t\tcm=this.b[b].c.length;\n\t\tfor (c=0;c<cm;c++) if (this.b[b].c[c]==x) return 1;\n\t}\n\treturn 0;\n};\n\nmxG.G.prototype.getE=function(id){return document.getElementById(this.n+id);};\n\nmxG.G.prototype.setFocus=function()\n{\n\tvar c,e,r,x,y;\n\tif (this.hasC(\"Navigation\")) {r=1;c=\"NavigationDiv\";}\n\telse if (this.hasC(\"Solve\")) {r=1;c=\"SolveDiv\";}\n\telse {r=0;c=\"InnerGobanDiv\";}\n\te=this.getE(c);\n\tif (e)\n\t{\n\t\tif (r)\n\t\t{\n\t\t\tx=window.pageXOffset||0;\n\t\t\ty=window.pageYOffset||0;\n\t\t}\n\t\t\/\/ does nothing if element is not display\n\t\tif (e&&(mxG.GetStyle(e,\"display\")!=\"none\")) e.focus();\n\t\t\/\/ scroll back to prevent browser scrolling that moves element to top of window\n\t\tif (r) window.scrollTo(x,y);\n\t}\n};\n\nmxG.G.prototype.getDW=function(e)\n{\n\tvar r=0;\n\tr+=mxG.GetPxStyle(e,\"paddingLeft\");\n\tr+=mxG.GetPxStyle(e,\"paddingRight\");\n\tr+=mxG.GetPxStyle(e,\"borderLeftWidth\");\n\tr+=mxG.GetPxStyle(e,\"borderRightWidth\")\n\treturn r;\n};\n\nmxG.G.prototype.getDH=function(e)\n{\n\tvar r=0;\n\tr+=mxG.GetPxStyle(e,\"paddingTop\");\n\tr+=mxG.GetPxStyle(e,\"paddingBottom\");\n\tr+=mxG.GetPxStyle(e,\"borderTopWidth\");\n\tr+=mxG.GetPxStyle(e,\"borderBottomWidth\")\n\treturn r;\n};\n\nmxG.G.prototype.createGBox=function(b)\n{\n\tvar e=document.createElement('div'),g;\n\tif (!this[b+\"Parent\"]) this[b+\"Parent\"]=\"Goban\";\n\tg=this.getE(this[b+\"Parent\"]+\"Div\");\n\te.className=\"mx\"+b+\"Div\";\n\te.id=this.n+b+\"Div\";\n\te.tabIndex=\"-1\";\n\te.style.position=\"absolute\";\n\te.style.left=\"0\";\n\te.style.top=\"0\";\n\te.style.display=\"none\";\n\te.style.outline=\"0\";\n\tg.appendChild(e);\n\treturn e;\n};\n\nmxG.G.prototype.resizeGBox=function(b)\n{\n\tvar g=this.getE(this[b+\"Parent\"]+\"Div\"),e=this.getE(b+\"Div\");\n\te.style.height=(mxG.GetPxStyle(g,\"height\")+this.getDH(g)-this.getDH(e))+\"px\";\n\te.style.width=(mxG.GetPxStyle(g,\"width\")+this.getDW(g)-this.getDW(e))+\"px\";\n};\n\nmxG.G.prototype.hideGBox=function(b)\n{\n\tif (b==this.gBox)\n\t{\n\t\tvar e=this.getE(b+\"Div\"),p,c;\n\t\te.style.display=\"none\";\n\t\tthis.gBox=\"\";\n\t\tp=this[b+\"Parent\"]+\"Div\";\n\t\tc=this.getE(p).className;\n\t\tthis.getE(p).className=c.replace(\/\\smxUnder\/,\"\");\n\t\tthis.updateAll();\n\t\tthis.setFocus(); \/\/ Chrome seems to need it?\n\t}\n};\n\nmxG.G.prototype.showGBox=function(b)\n{\n\tif (b==this.gBox) return;\n\tvar e=this.getE(b+\"Div\"),p,c;\n\tif (this.gBox)\n\t{\n\t\tthis.getE(this.gBox+\"Div\").style.display=\"none\";\n\t\tp=this[this.gBox+\"Parent\"]+\"Div\";\n\t\tc=this.getE(p).className;\n\t\tthis.getE(p).className=c.replace(\/\\smxUnder\/,\"\");\n\t}\n\te.style.display=\"block\";\n\tthis.resizeGBox(b);\n\tthis.gBox=b;\n\tp=this[b+\"Parent\"]+\"Div\";\n\tthis.getE(p).className+=\" mxUnder\";\n\tthis.updateAll();\n\te.focus();\n};\n\nmxG.G.prototype.enableBtn=function(b)\n{\n\tthis.getE(b+\"Btn\").disabled=false;\n};\n\nmxG.G.prototype.disableBtn=function(b)\n{\n\tvar e=this.getE(b+\"Btn\"),p=e.parentNode;\n\te.disabled=true;\n\tif (document.activeElement==e) \/\/ see hint.txt\n\t\tif (((this.hasC(\"Navigation\")&&(this.getE(\"NavigationDiv\")==p)))\n\t\t  ||((this.hasC(\"Solve\")&&(this.getE(\"SolveDiv\")==p)))) p.focus();\n};\n\nmxG.G.prototype.addBtn=function(b)\n{\n\tif (!b.t&&this[b.n.lcFirst()+\"Tip_\"+mxG.L_]) b.t=this[b.n.lcFirst()+\"Tip_\"+mxG.L_];\n\tthis.write(\"<button class=\\\"mxBtn mx\"+b.n+\"Btn\\\" \"+(b.t?\"title=\\\"\"+b.t+\"\\\" \":\"\")\n\t\t\t   +\" autocomplete=\\\"off\\\"\"\n\t\t\t   +\" id=\\\"\"+this.n+b.n+\"Btn\\\" onclick=\\\"\"+this.g+\".do\"+b.n+\"();\\\">\");\n\tthis.write(b.v?\"<span>\"+b.v+\"<\/span>\":\"<canvas width=\\\"0\\\" height=\\\"0\\\"\"\n\t\t\t   +\" id=\\\"\"+this.n+b.n+\"Cn\\\"><\/canvas>\");\n\tthis.write(\"<\/button>\");\n};\n\nmxG.G.prototype.xy=function(x,y){return (x-1)*this.DY+y-1;};\nmxG.G.prototype.xy2s=function(x,y)\n{return (x&&y)?String.fromCharCode(x+((x>26)?38:96),y+((y>26)?38:96)):\"\";};\n\n\/\/ place nodes\n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\n\nmxG.G.prototype.placeAX=function()\n{\n\tvar v,z,k,km,s,x,y,x1,y1,x2,y2,AX=[\"AB\",\"AW\",\"AE\"];\n\tfor (z=0;z<3;z++)\n\t{\n\t\tkm=((v=this.cN.P[AX[z]])?v.length:0);\n\t\tfor (k=0;k<km;k++)\n\t\t{\n\t\t\ts=v[k];\n\t\t\tif (s.length==2)\n\t\t\t{\n\t\t\t\tx=s.c2n(0);\n\t\t\t\ty=s.c2n(1);\n\t\t\t\tthis.gor.place(AX[z],x,y);\n\t\t\t}\n\t\t\telse if (s.length==5)\n\t\t\t{\n\t\t\t\tx1=s.c2n(0);\n\t\t\t\ty1=s.c2n(1);\n\t\t\t\tx2=s.c2n(3);\n\t\t\t\ty2=s.c2n(4);\n\t\t\t\tfor (x=x1;x<=x2;x++) for (y=y1;y<=y2;y++) this.gor.place(AX[z],x,y);\n\t\t\t}\n\t\t}\n\t}\n};\n\nmxG.G.prototype.placeBW=function(nat)\n{\n\tvar s=this.cN.P[nat][0],x=0,y=0;\n\tif (s.length==2)\n\t{\n\t\tx=s.c2n(0);\n\t\ty=s.c2n(1);\n\t}\n\tthis.gor.place(nat,x,y);\n};\n\nmxG.G.prototype.repareNode=function(aN)\n{\n\tvar k,ko,km,c;\n\tif (aN.P.L)\n\t{\n\t\tkm=aN.P.L.length;\n\t\tif (km)\n\t\t{\n\t\t\tif (!aN.P.LB) aN.P.LB=[];\n\t\t\tko=aN.P.LB.length;\n\t\t\tfor (k=0;k<km;k++) aN.P.LB[k+ko]=aN.P.L[k]+\":\"+String.fromCharCode(97+k);\n\t\t}\n\t\tdelete aN.P.L;\n\t}\n\tif (aN.P.M)\n\t{\n\t\tif (aN.P.M.length)\n\t\t{\n\t\t\tif (!aN.P.MA) aN.P.MA=aN.P.M;\n\t\t\telse aN.P.MA=aN.P.MA.concat(aN.P.M);\n\t\t}\n\t\tdelete aN.P.M;\n\t}\n};\n\nmxG.G.prototype.placeNode=function()\n{\n\tif (this.cN.KidOnFocus())\n\t{\n\t\tthis.cN=this.cN.KidOnFocus();\n\t\tif (this.cN.P.L||this.cN.P.M) this.repareNode(this.cN);\n\t\tif (this.cN.P.B) this.placeBW(\"B\");\n\t\telse if (this.cN.P.W) this.placeBW(\"W\");\n\t\telse if (this.cN.P.AB||this.cN.P.AW||this.cN.P.AE) this.placeAX();\n\t}\n};\n\nmxG.G.prototype.changeFocus=function(aN)\n{\n\tvar k,km,bN=aN;\n\twhile (bN!=this.rN)\n\t{\n\t\tif (bN.Dad.KidOnFocus()!=bN)\n\t\t{\n\t\t\tkm=bN.Dad.Kid.length;\n\t\t\tfor (k=0;k<km;k++) if (bN.Dad.Kid[k]==bN) {bN.Dad.Focus=k+1;break;}\n\t\t}\n\t\tbN=bN.Dad;\n\t}\n};\n\nmxG.G.prototype.backNode=function(aN)\n{\n\tthis.changeFocus(aN);\n\tthis.cN=this.rN;\n\tthis.setSz();\n\tthis.gor.init(this.DX,this.DY);\n\twhile (this.cN!=aN) this.placeNode();\n};\n\n\/\/ set\n\/\/\/\/\/\/\n\nmxG.G.prototype.getInfo=function(p)\n{\n\tvar aN=this.cN;\n\tif ((p==\"MN\")||(p==\"PM\")||(p==\"FG\")) {if (aN==this.rN) aN=aN.KidOnFocus();}\n\tif ((p==\"PM\")||(p==\"FG\")) while ((aN!=this.rN)&&!aN.P[p]) aN=aN.Dad;\n\telse {aN=this.rN;while (aN&&!aN.P[p]) aN=aN.KidOnFocus();}\n\tif (aN&&aN.P[p]) return aN.P[p][0]+\"\";\n\tif (p==\"SZ\") return \"19\";\n\tif (p==\"PM\") return \"1\";\n\tif ((p==\"ST\")||(p==\"FG\")) return \"0\";\n\treturn \"\";\n};\n\nmxG.G.prototype.getInfoS=function(p)\n{\n\treturn this.htmlInSgfOn?this.getInfo(p):mxG.tag2special(this.getInfo(p));\n}\n\nmxG.G.prototype.setSz=function()\n{\n\tvar D=this.getInfo(\"SZ\").split(\":\"),DX=this.DX,DY=this.DY;\n\tthis.DX=parseInt(D[0]);\n\tthis.DY=((D.length>1)?parseInt(D[1]):this.DX);\n\tif ((DX!=this.DX)||(DY!=this.DY)) this.hasToDrawWholeGoban=1;\n};\n\nmxG.G.prototype.setVw=function()\n{\n\t\/\/ if VW is not a rectangle, set surrounding rectangle of all VW\n\tvar aN=this.cN,x,y,s,k,km,xl,yt,xr,yb;\n\tif (aN==this.rN) aN=this.rN.KidOnFocus();\n\twhile ((aN!=this.rN)&&!aN.P.VW) aN=aN.Dad;\n\txl=this.xl;\n\tyt=this.yt;\n\txr=this.xr;\n\tyb=this.yb;\n\tif (aN.P.VW)\n\t{\n\t\tthis.xl=this.DX;\n\t\tthis.yt=this.DY;\n\t\tthis.xr=1;\n\t\tthis.yb=1;\n\t\tkm=aN.P.VW.length;\n\t\tfor (k=0;k<km;k++)\n\t\t{\n\t\t\ts=aN.P.VW[k];\n\t\t\tif (s.length==5)\n\t\t\t{\n\t\t\t\tthis.xl=Math.min(this.xl,s.c2n(0));\n\t\t\t\tthis.yt=Math.min(this.yt,s.c2n(1));\n\t\t\t\tthis.xr=Math.max(this.xr,s.c2n(3));\n\t\t\t\tthis.yb=Math.max(this.yb,s.c2n(4));\n\t\t\t}\n\t\t\telse if (s.length==2)\n\t\t\t{\n\t\t\t\tx=s.c2n(0);\n\t\t\t\ty=s.c2n(1);\n\t\t\t\tthis.xl=Math.min(this.xl,x);\n\t\t\t\tthis.yt=Math.min(this.yt,y);\n\t\t\t\tthis.xr=Math.max(this.xl,x);\n\t\t\t\tthis.yb=Math.max(this.yt,y);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tthis.xl=1;\n\t\t\t\tthis.yt=1;\n\t\t\t\tthis.xr=this.DX;\n\t\t\t\tthis.yb=this.DY;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\telse\n\t{\n\t\tthis.xl=1;\n\t\tthis.yt=1;\n\t\tthis.xr=this.DX;\n\t\tthis.yb=this.DY;\n\t}\n\tthis.xli=this.xl;\n\tthis.yti=this.yt;\n\tthis.xri=this.xr;\n\tthis.ybi=this.yb;\n\tif ((xl!=this.xl)||(yt!=this.yt)||(xr!=this.xr)||(yb!=this.yb)) this.hasToDrawWholeGoban=1;\n};\n\nmxG.G.prototype.setPl=function()\n{\n\tvar aN=this.rN;\n\tthis.uC=\"B\";\n\twhile (aN.Focus)\n\t{\n\t\taN=aN.Kid[0];\n\t\tif (aN.P)\n\t\t{\n\t\t\tif (aN.P.PL)\n\t\t\t{\n\t\t\t\tthis.uC=aN.P.PL;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse if (aN.P.B||aN.P.W)\n\t\t\t{\n\t\t\t\tif (aN.P.B) this.uC=\"B\";\n\t\t\t\telse if (aN.P.W) this.uC=\"W\";\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tthis.oC=((this.uC==\"W\")?\"B\":\"W\");\n};\n\nmxG.G.prototype.setImg=function(nat,d)\n{\n\tvar cn,cx,im=new Image(),sz,c=(nat==\"B\")?\"black\":\"white\",s=c+\"StoneData\";\n\tim.canDraw=0;\n\tim.onload=function(){if (this.src) this.canDraw=1;};\n\tif (this.customStone)\n\t{\n\t\tif (this.customStone==\"data:\") {if (this[s]) {im.src=this[s];return im;}}\n\t\telse\n\t\t{\n\t\t\tif (d<9) sz=9;else if (d<31) sz=d;else sz=31;\n\t\t\tim.src=this.path+this.customStone+c+(this.in3dOn?\"3d\":\"2d\")+sz+\".png\";\n\t\t\treturn im;\n\t\t}\n\t}\n\tcn=document.createElement(\"canvas\");\n\tcn.width=cn.height=d;\n\tcx=cn.getContext(\"2d\");\n\tthis.drawStone(cx,nat,d);\n\tim.src=cn.toDataURL(\"image\/png\");\n\treturn im;\n};\n  \nmxG.G.prototype.setD=function()\n{\n\tvar exD=(this.d?this.d:0),cn=this.getE(\"GobanCanvas\"),gb,gbp,fs,wgbp,z,dx,i;\n\tif (!exD&&this.gobanFs) cn.style.fontSize=this.gobanFs;\n\tfs=mxG.GetPxStyle(cn,\"fontSize\");\n\tif (this.fitParent&1)\n\t{\n\t\tif (this.configFitMax===undefined) this.configFitMax=this.fitMax?this.fitMax:0;\n\t\tif (!this.configFitMax)\n\t\t{\n\t\t\ti=((this.configIndicesOn||this.indicesOn)?2:0);\n\t\t\tif (this.maximizeGobanWidth) dx=Math.max(19,this.DX)+i;\n\t\t\telse if (this.xri) dx=this.xri-this.xli+1;\n\t\t\telse if (this.DX) dx=this.DX+i;\n\t\t\telse dx=19+i;\n\t\t\tthis.fitMax=dx;\n\t\t}\n\t\tgb=this.getE(this.globalBox+\"Div\");\n\t\tgbp=gb.parentNode;\n\t\twgbp=mxG.GetPxStyle(gbp,\"width\")-this.getDW(gb)-(this.fitDelta?this.fitDelta:0);\n\t\t\/\/ trick to avoid possible resizing loop\n\t\tif (!mxG.hasVerticalScrollBar()) wgbp-=mxG.verticalScrollBarWidth(); \n\t\tfs=Math.max(3,Math.min(fs,Math.floor(wgbp\/(this.fitMax*1.5))));\n\t}\n\tthis.d=2*Math.floor(fs*3\/4)+1;\n\tz=(this.border===undefined)?this.d>>3:this.border;\n\tif ((this.fitParent&1)&&((this.d*this.fitMax+z*2)>wgbp)) this.d-=2;\n\tif (this.d!=exD)\n\t{\n\t\tthis.z=z;\n\t\tthis.d2=(this.stretchOn?Math.floor(this.d\/10):0);\n\t\tthis.lw=(this.lineWidth?this.lineWidth:Math.floor(1+this.d\/42));\n\t\tthis.img={B:this.setImg(\"B\",this.d),W:this.setImg(\"W\",this.d)};\n\t\tthis.imgSmall={B:this.setImg(\"B\",1+this.d>>1),W:this.setImg(\"W\",1+this.d>>1)};\n\t\tif (this.hasC(\"Edit\"))\n\t\t\tthis.imgBig={B:this.setImg(\"B\",this.toolSize()-this.et*2),\n\t\t\t\t\t\t W:this.setImg(\"W\",this.toolSize()-this.et*2)};\n\t}\n};\n\n\/\/ main\n\/\/\/\/\/\/\/\n\nmxG.G.prototype.initAll=function()\n{\n\tvar c,s;\n\tif (!this.rN.Focus) new mxG.P(this,this.so);\n\tthis.cN=this.rN;\n\tthis.setSz();\n\tthis.gor.init(this.DX,this.DY);\n\tthis.setD();\n\tfor (c=0;c<this.m;c++) {s=\"init\"+this.c[c];if (this[s]) this[s]();}\n};\n\nmxG.G.prototype.updateAll=function()\n{\n\tvar c,s;\n\t\/\/ reset loop here when lesson only\n\tif (this.hasC(\"Loop\")&&this.hasC(\"Lesson\")) this.resetLoop();\n\tif (this.hasC(\"Variations\")) this.setMode();\n\tthis.setVw();\n\tif (this.hasC(\"Diagram\")) {this.setIndices();this.setNumbering();}\n\tfor (c=0;c<this.m;c++) {s=\"update\"+this.c[c];if (this[s]) this[s]();}\n};\n\nmxG.G.prototype.refreshAll=function()\n{\n\tvar c,s;\n\tthis.setD();\n\tfor (c=0;c<this.m;c++) {s=\"refresh\"+this.c[c];if (this[s]) this[s]();}\n};\n\nmxG.G.prototype.start=function()\n{\n\tvar t=this.refreshTime,s=this.g+\".refreshAll()\";\n\tthis.initAll();\n\tthis.placeNode();\n\tif (this.initMethod==\"last\") while (this.cN.KidOnFocus()) this.placeNode();\n\tthis.updateAll();\n\tthis.startDone=1;\n\tsetTimeout(s,t\/10);\n\tsetTimeout(s,t\/5);\n\tsetInterval(s,t);\n\tif (mxG.ExecutionTime) mxG.ExecutionTime();\n};\n\nmxG.G.prototype.createBox=function(c)\n{\n\tvar s=\"create\"+c;\n\tthis.c.push(c);\n\tif (this[s]) this[s]();\n};\n\nmxG.G.prototype.setA=function()\n{\n\tvar i,j,im=this.s.attributes.length,jm,n,s,a,b,bs,k,km;\n\tfor (i=0;i<im;i++)\n\t{\n\t\tn=this.s.attributes.item(i).nodeName;\n\t\tif (n.match(\/^data-maxigos-\/))\n\t\t{\n\t\t\ta=n.replace(\/^data-maxigos-\/,\"\").split(\"-\");\n\t\t\ts=a[0];\n\t\t\tjm=a.length;\n\t\t\tfor (j=1;j<jm;j++) s+=a[j].ucFirst();\n\t\t\tb=this.s.getAttribute(n);\n\t\t\tthis[s]=b.match(\/^[0-9]+$\/)?parseInt(b):b;\n\t\t}\n\t}\n};\n\nmxG.G.prototype.createWait=function()\n{\n\tvar ws=\"font-size:1.5em;text-align:center;background:#fff;border:5px solid #f00;color:#f00;\";\n\tws+=\"display:none;\";\n\tthis.write(\"<div style=\\\"\"+ws+\"\\\" id=\\\"\"+this.n+\"Wait\\\">\"+this.local(\"Loading...\")+\"<\/div>\");\n};\n\nmxG.G.prototype.showWait=function()\n{\n\tvar e=this.getE(\"Wait\");\n\tif (e&&this.wait) e.style.display=\"block\";\n};\n\nmxG.G.prototype.startWait=function()\n{\n\tthis.wait=1;\n\tsetTimeout(this.g+\".showWait()\",1000);\n};\n\nmxG.G.prototype.stopWait=function()\n{\n\tvar e=this.getE(\"Wait\");\n\tthis.wait=0;\n\tif (e) e.style.display=\"none\";\n};\n\nmxG.G.prototype.afterGetF=function()\n{\n\tif (!this.startDone) {setTimeout(this.g+\".afterGetF()\",25);return;}\n\tnew mxG.P(this,this.fromF);\n\tif (this.hasC(\"Tree\")) this.initTree();\n\tthis.backNode(this.rN.KidOnFocus());\n\tif (this.initMethod==\"last\") while (this.cN.KidOnFocus()) this.placeNode();\n\tthis.updateAll();\n\tthis.stopWait();\n\tif (mxG.ExecutionTime) mxG.ExecutionTime();\n};\n\nmxG.G.prototype.getF=function(f,c)\n{\n\tvar xhr=new XMLHttpRequest();\n\txhr.gos=this;\n\txhr.f=f;\n\txhr.c=c;\n\txhr.onreadystatechange=function()\n\t{\n\t\tvar s,m,c;\n\t\tif (this.readyState==4)\n\t\t{\n\t\t\tif (this.status!=200) {this.gos.stopWait();return;}\n\t\t\ts=this.responseText;\n\t\t\tif (!this.c&&this.overrideMimeType)\n\t\t\t{\n\t\t\t\tif (m=s.match(\/CA\\[([^\\]]*)\\]\/)) c=m[1].toUpperCase();else c=\"ISO-8859-1\";\n\t\t\t\tif (c!=\"UTF-8\")\n\t\t\t\t{\n\t\t\t\t\t\/\/ retry with charset found in sgf\n\t\t\t\t\tthis.gos.getF(this.f,c);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.gos.fromF=s;\n\t\t\tthis.gos.afterGetF();\n\t\t}\n\t};\n\txhr.open(\"GET\",xhr.f,true);\n\tif (c&&xhr.overrideMimeType) xhr.overrideMimeType(\"text\/plain;charset=\"+c);\n\txhr.send(null);\n};\n\nmxG.G.prototype.getS=function()\n{\n\tvar e=this.s,fo,f=e.getAttribute(\"data-sgf-file\"),s=this.so;\n\tthis.startWait();\n\tif (!f&&(((e==this.j)&&(e.getAttribute(\"src\")))||(e!=this.j)))\n\t{\n\t\ts=e.innerHTML;\n\t\tif (this.htmlParenthesis) s=s.replace(\/&#40;\/g,'(').replace(\/&#41;\/g,')');\n\t\tif (!s.match(\/\\(\/)) f=s.replace(\/^\\s+([^\\s])\/,\"$1\").replace(\/([^\\s])\\s+$\/,\"$1\");\n\t}\n\tif (f)\n\t{\n\t\tfo=f.split(\"?\")[0].split(\"\/\").reverse()[0];\n\t\tif (fo.match(\/\\.sgf$\/)||(this.sourceFilter&&f.match(new RegExp(this.sourceFilter))))\n\t\t{\n\t\t\t\/\/ get file with \"sgf\" extension or source that matches this.sourceFilter\n\t\t\tthis.sgf=fo;\n\t\t\tthis.getF(f,\"\");\n\t\t\treturn;\n\t\t}\n\t}\n\tif (!this.rN.Focus) new mxG.P(this,s);\n\tthis.stopWait();\n};\n\nmxG.G.prototype.createAll=function()\n{\n\tvar b,bm,c,cm,k=this.k,cls,gbx=this.globalBox;\n\tmxG.L_=mxG.L.replace(\"-\",\"_\"); \/\/ to deal language codes that contain \"-\" such as \"zh-tw\"\n\tif (!mxG.CanCn()||!mxG.CanToDataURL()||this.alternativeOn)\n\t{\n\t\tif (typeof mxG.A=='undefined')\n\t\t\tthis.write(\"<div class=\\\"mxErrorDiv\\\">\"+this.local(\"Require HTML5!\")+\"<\/div>\");\n\t\telse this.a=new mxG.A(this);\n\t\treturn;\n\t}\n\tthis.setA();\n\tif (!this.rN.Focus) this.getS();\n\tcls=\"mx\"+gbx+\"Div\"+(gbx!=\"GlobalBox\"?\" mxGlobalBoxDiv\":\"\")+\" mxIn\"+(this.in3dOn?\"3d\":\"2d\");\n\tthis.write(\"<div class=\\\"\"+cls+\"\\\" id=\\\"\"+this.n+gbx+\"Div\\\">\");\n\tthis.createWait();\n\tbm=this.b.length;\n\tfor (b=0;b<bm;b++)\n\t{\n\t\tthis.write(\"<div id=\\\"\"+this.n+this.b[b].n+\"Div\\\" class=\\\"mx\"+this.b[b].n+\"Div\\\">\");\n\t\tcm=this.b[b].c.length;\n\t\tfor (c=0;c<cm;c++) this.createBox(this.b[b].c[c]);\n\t\tthis.write(\"<\/div>\");\n\t}\n\tthis.write(\"<\/div>\");\n\tthis.write(\"<div id=\\\"\"+this.n+\"DebugDiv\\\"><\/div>\");\n\tthis.m=this.c.length;\n\tif (this.j==this.s) \/\/ too soon to call this.start()\n\t\twindow.addEventListener(\"load\",function(){mxG.D[k].start();},false);\n\telse \/\/ too late to call addEventListener(), typically when using mgosLoader.js\n\t{\n\t\tthis.s.innerHTML=this.h;\n\t\tthis.start();\n\t}\n};\n\n}\n\n\/\/ maxiGos v6.51 > mgosGoban.js Copyright 2002-2016 Francois Mizessyn, BSD license (see license.txt)\n\nif (typeof mxG.G.prototype.createGoban=='undefined'){\n\nmxG.G.prototype.deplonkGoban=function()\n{\n\tthis.getE(\"GobanDiv\").style.visibility=\"visible\";\n};\n\nmxG.G.prototype.plonk=function()\n{\n\tif (!this.silentFail)\n\t{\n\t\tthis.getE(\"GobanDiv\").style.visibility=\"hidden\";\n\t\tsetTimeout(this.g+\".deplonkGoban()\",50);\n\t}\n};\n\nmxG.G.prototype.getEmphasisColor=function(k)\n{\n\tif (k)\n\t{\n\t\tif (k&this.goodnessCode.Good) return this.goodColor?this.goodColor:0;\n\t\tif (k&this.goodnessCode.Bad) return this.badColor?this.badColor:0;\n\t\tif (k&this.goodnessCode.Even) return this.evenColor?this.evenColor:0;\n\t\tif (k&this.goodnessCode.Warning) return this.warningColor?this.warningColor:0;\n\t\tif (k&this.goodnessCode.Unclear) return this.unclearColor?this.unclearColor:0;\n\t\tif (k&this.goodnessCode.OffPath) return this.offPathColor?this.offPathColor:0;\n\t}\n\treturn this.neutralColor?this.neutralColor:0;\n};\n\nmxG.G.prototype.getC=function(ev)\n{\n\tvar x,y,c=this.getE(\"GobanCanvas\").getMClick(ev);\n\tx=Math.max(Math.min(Math.floor((c.x-this.z)\/this.d)+this.xli,this.xri),this.xli);\n\ty=Math.max(Math.min(Math.floor((c.y-this.z)\/(this.d+this.d2))+this.yti,this.ybi),this.yti);\n\treturn {x:x,y:y}\n};\n\nmxG.G.prototype.whichMove=function(x,y)\n{\n\tvar cN=this.cN,aN,s,a,b,km;\n\tif (!(this.styleMode&3))\n\t{\n\t\tkm=cN.Kid.length;\n\t\tfor (k=0;k<km;k++)\n\t\t{\n\t\t\taN=cN.Kid[k];\n\t\t\tif (aN.P.B) s=aN.P.B[0];\n\t\t\telse if (aN.P.W) s=aN.P.W[0];\n\t\t\telse s=\"\";\n\t\t\tif (s)\n\t\t\t{\n\t\t\t\ta=s.c2n(0);\n\t\t\t\tb=s.c2n(1);\n\t\t\t\tif ((a==x)&&(b==y)) return aN;\n\t\t\t}\n\t\t}\n\t}\n\treturn 0;\n};\n\nmxG.G.prototype.isNextMove=function(x,y)\n{\n\tvar aN,s,a,b;\n\tif (!(this.styleMode&3))\n\t{\n\t\taN=this.cN.KidOnFocus();\n\t\tif (aN)\n\t\t{\n\t\t\tif (aN.P.B) s=aN.P.B[0];\n\t\t\telse if (aN.P.W) s=aN.P.W[0];\n\t\t\telse s=\"\";\n\t\t\tif (s)\n\t\t\t{\n\t\t\t\ta=s.c2n(0);\n\t\t\t\tb=s.c2n(1);\n\t\t\t\tif ((a==x)&&(b==y)) return aN;\n\t\t\t}\n\t\t}\n\t}\n\treturn 0;\n};\n\nmxG.G.prototype.star=function(x,y)\n{\n\tvar DX=this.DX,DY=this.DY,A=4,B=((DX+1)>>1),C=DX+1-A,D=((DY+1)>>1),E=DY+1-A;\n\tif ((DX&1)&&(DY&1))\n\t{\n\t\tif ((DX>17)&&(DY>17)) return ((x==A)||(x==B)||(x==C))&&((y==A)||(y==D)||(y==E));\n\t\tif ((DX>11)&&(DY>11)) return (((x==A)||(x==C))&&((y==A)||(y==E)))||((x==B)&&(y==D));\n\t\treturn (x==B)&&(y==D);\n\t}\n\tif ((DX>11)&&(DY>11)) return ((x==A)||(x==C))&&((y==A)||(y==E));\n\treturn false;\n};\n\nmxG.G.prototype.inView=function(x,y)\n{\n\treturn (x>=this.xl)&&(y>=this.yt)&&(x<=this.xr)&&(y<=this.yb);\n};\n\nmxG.G.prototype.isCross=function(x,y)\n{\n\treturn (this.inView(x,y)&&(this.vNat[this.xy(x,y)]==\"E\")&&((this.vStr[this.xy(x,y)]==\"\")||(this.vStr[this.xy(x,y)]==\"_TB_\")||(this.vStr[this.xy(x,y)]==\"_TW_\")));\n};\n\nmxG.G.prototype.drawStar=function(cx,a,b,r)\n{\n\tif (r>1)\n\t{\n\t\tvar q=(this.starRatio?this.starRatio:0.2);\n\t\tcx.fillStyle=this.starColor?this.starColor:this.lineColor;\n\t\tcx.beginPath();\n\t\tcx.arc(a+r,b+r,this.starRadius?this.starRadius:Math.max(1.5,r*q+0.5),0,Math.PI*2,false);\n\t\tcx.fill();\n\t}\n};\n\nmxG.G.prototype.drawStone=function(cx,nat,d)\n{\n\tvar r=d\/2;\n\tcx.beginPath();\n\tcx.arc(r,r,r-0.6*this.lw,0,Math.PI*2,false);\n\tif (this.in3dOn)\n\t{\n\t\tvar zx=0.8,zy=0.5,x1,y1,rG;\n\t\tx1=zx*r;\n\t\ty1=zy*r;\n\t\trG=cx.createRadialGradient(x1,y1,0.2*r,x1,y1,2*r);\n\t\trG.addColorStop(0,(nat==\"B\")?\"#999\":\"#fff\");\n\t\trG.addColorStop(0.3,(nat==\"B\")?\"#333\":\"#ccc\");\n\t\trG.addColorStop(1,\"#000\");\n\t\tcx.fillStyle=rG;\n\t\tcx.fill();\n\t\tif (nat==\"B\")\n\t\t{\n\t\t\trG=cx.createRadialGradient((zx>1?0.8:1.2)*r,(zy>1?0.8:1.2)*r,1,(zx>1?0.8:1.2)*r,(zy>1?0.8:1.2)*r,0.9*r);\n\t\t\trG.addColorStop(0,\"rgba(0,0,0,0.8)\");\n\t\t\trG.addColorStop(0.5,\"rgba(0,0,0,0.6)\");\n\t\t\trG.addColorStop(1,\"rgba(0,0,0,0.1)\");\n\t\t\tcx.fillStyle=rG;\n\t\t\tcx.fill();\n\t\t}\n\t}\n\telse\n\t{\n\t\tcx.fillStyle=(nat==\"B\")?\"#000\":\"#fff\";\n\t\tcx.fill();\n\t\tcx.strokeStyle=\"#000\";\n\t\tcx.lineWidth=this.lw;\n\t\tcx.stroke();\n\t}\n};\n\nmxG.G.prototype.getFs=function(cx,d,fw)\n{\n\t\/\/ better to call it just before fillText\n\tvar fs=0; \/\/ safer to start at 0 since zoom text only may be disturbing \n\tdo {cx.font=fw+\" \"+(fs++)+\"px\"+\" \"+\"Arial\";} while ((fs<99)&&(3*cx.measureText(\"9\").width<d));\n\treturn fs;\n};\n\t\t\nmxG.G.prototype.drawText=function(cx,x,y,d,s,op)\n{\n\tvar r=d\/2,sf,c=0,sc=0;\n\tcx.save();\n\tif (op&&op.c) c=op.c;\n\tif (op&&op.sc) sc=op.sc;\n\tif (c) cx.fillStyle=c;\n\tif (sc) {cx.strokeStyle=sc;cx.lineWidth=3;}\n\telse if (mxG.IsMacSafari()&&(c==\"#fff\"))\n\t{\n\t\t\/\/ otherwise white text may be too light\n\t\tsc=c;cx.strokeStyle=sc;cx.lineWidth=0.75;\n\t}\n\tif (op&&op.fw) fw=op.fw;\n\telse fw=\"normal\";\n\ts+=\"\";\n\tcx.textBaseline=\"alphabetic\"; \/\/ \"middle\" is buggy on FF\n\tcx.textAlign=\"center\";\n\tcx.font=fw+\" \"+this.getFs(cx,d,fw)+\"px\"+\" \"+\"Arial\";\n\tsf=(s.length>3)?0.5:(s.length>2)?0.7:(s.length>1)?0.9:1;\n\tcx.scale(sf,1);\n\tif (sc) cx.strokeText(s,(x+r)\/sf,y+(d>>1)+(d>>2)); \/\/ if (cx.textBaseline==\"middle\") use y+r\n\tcx.fillText(s,(x+r)\/sf,y+(d>>1)+(d>>2)); \/\/ if (cx.textBaseline==\"middle\") use y+r\n\tcx.restore();\n};\n\nmxG.G.prototype.drawMarkOnLast=function(cx,x,y,d,c)\n{\n\tvar dm=Math.floor(d\/3);\n\tcx.fillStyle=this.markOnLastColor?this.markOnLastColor:c;\n\tcx.fillRect(x+dm,y+dm,d-2*dm,d-2*dm);\n};\n\nmxG.G.prototype.drawVariationEmphasis=function(cx,a,b,d,x,y,m)\n{\n\tvar aN,c,fw,sc;\n\taN=this.whichMove(x,y);\n\tc=this.getEmphasisColor(aN?aN.Good:0);\n\tc=(c?c:this.lineColor);\n\tif (this.variationAsMarkOn||!this.hasC(\"Diagram\"))\n\t{\n\t\tcx.lineWidth=2;\n\t\tcx.strokeStyle=c;\n\t\tcx.beginPath();\n\t\tcx.arc(a+d\/2,b+d\/2,d\/5,0,Math.PI*2,false);\n\t\tcx.stroke();\t\n\t\tif (this.isNextMove(x,y))\n\t\t{\n\t\t\tcx.fillStyle=c;\n\t\t\tcx.beginPath();\n\t\t\tcx.arc(a+d\/2,b+d\/2,d\/10,0,Math.PI*2,false);\n\t\t\tcx.fill();\t\n\t\t}\n\t}\n\telse\n\t{\n\t\tif (this.variationOnFocusFontWeight&&this.isNextMove(x,y)) fw=this.variationOnFocusFontWeight;\n\t\telse if (this.variationFontWeight) fw=this.variationFontWeight;\n\t\telse fw=\"normal\";\n\t\tif (this.variationOnFocusStrokeColor&&this.isNextMove(x,y)) sc=this.variationOnFocusStrokeColor;\n\t\telse if (this.variationStrokeColor) sc=this.variationStrokeColor;\n\t\telse sc=0;\n\t\tm=this.removeLabelDelimiters(m);\n\t\tthis.drawText(cx,a,b,d,m,{c:c,fw:fw,sc:sc});\n\t}\n};\n\nmxG.G.prototype.drawPointColor=function(x,y,nat,v,l,mtsc)\n{\n\tvar c;\n\tif (v&&this.variationOnFocusColor&&this.isNextMove(x,y)) c=this.variationOnFocusColor;\n\telse if (v&&this.variationColor) c=this.variationColor;\n\telse if ((l||mtsc)&&this.markAndLabelColor) c=this.markAndLabelColor;\n\telse c=(nat==\"B\")?\"#fff\":(nat==\"W\")?\"#000\":((nat==\"O\")&&this.outsideColor)?this.outsideColor:this.lineColor;\n\treturn c;\n};\n\nmxG.G.prototype.drawPoint=function(cx,x,y,nat,m)\n{\n\tvar d=this.d,r=d\/2,z=this.z,d2=this.d2,d3=(d2&1?1:0),d4;\n\tvar a=(x-this.xli)*d+z,b=(y-this.yti)*(d+d2)+(d2>>1)+d3+z;\n\tvar dxl=0,dyt=0,dxr=0,dyb=0,v=0,l=0,mtsc=0,xo,yo,wo,ho,bk,c,fw,sbk,sbkw,sc;\n\tvar aN;\n\tcx.lineWidth=this.lw;\n\tif (this.hasC(\"Diagram\")) m=this.preTerritory(x,y,nat,m);\n\tif (x==this.xl) dxl=z;\n\tif (y==this.yt) dyt=z;\n\tif (x==this.xr) dxr=z;\n\tif (y==this.yb) dyb=z;\n\tif (x==0) a=a-z;\n\tif (y==0) {b=b-z;dyb=dyb-d3;}\n\tif (x==(this.DX+1)) a=a+z;\n\tif (y==(this.DY+1)) {b=b+z+d3;dyb=dyb-d3;}\n\txo=a-dxl;\n\tyo=b-(d2>>1)-d3-dyt;\n\two=d+dxl+dxr;\n\tho=d+d2+d3+dyt+dyb;\n\tcx.beginPath();\n\tif ((nat==\"O\")&&this.outsideBk)\n\t{\n\t\tcx.fillStyle=this.outsideBk;\n\t\tcx.fillRect(xo,yo,wo,ho);\n\t}\n\telse cx.clearRect(xo,yo,wo,ho);\n\t\n\tif (this.gobanFocusVisible&&(this.xFocus==x)&&(this.yFocus==y)&&this.inView(x,y)&&!this.inSelect)\n\t{\n\t\tthis.flw=(this.focusLineWidth?this.focusLineWidth:2*this.lw);\n\t\tcx.lineWidth=this.flw;\n\t\tcx.strokeStyle=this.focusColor;\n\t\tcx.strokeRect(a+this.flw\/2,b+this.flw\/2,d-this.flw,d-this.flw);\n\t\tcx.lineWidth=this.lw;\n\t}\n\n\tif (this.hasC(\"Variations\")&&this.isVariation(m))\n\t{\n\t\tv=1;\n\t\tm=this.removeVariationDelimiters(m);\n\t\tif (!this.variationEmphasisOn)\n\t\t{\n\t\t\tif (this.variationOnFocusBk&&this.isNextMove(x,y)) bk=this.variationOnFocusBk;\n\t\t\telse if (this.variationBk) bk=this.variationBk;\n\t\t\tif (bk) {cx.fillStyle=bk;cx.fillRect(a+1,b+1,d-2,d-2);}\n\t\t\tif (this.variationOnFocusStrokeBk&&this.isNextMove(x,y)) sbk=this.variationOnFocusStrokeBk;\n\t\t\telse if (this.variationStrokeBk) sbk=this.variationStrokeBk;\n\t\t\tif (sbk) {sbkw=this.lw\/2;cx.strokeStyle=sbk;cx.strokeRect(a+1+sbkw,b+1+sbkw,d-2-2*sbkw,d-2-2*sbkw);}\n\t\t}\n\t}\n\tif ((!v&&(((nat==\"E\")&&!m)||(m==\"_TB_\")||(m==\"_TW_\")))||(v&&this.variationEmphasisOn))\n\t{\n\t\tif (((m==\"_TB_\")||(m==\"_TW_\"))||!(v&&this.variationEmphasisOn&&!this.variationAsMarkOn))\n\t\t{\n\t\t\tcx.strokeStyle=this.lineColor;\n\t\t\tif (this.borderLineWidth&&((x==1)||(x==this.DX))) cx.lineWidth=this.borderLineWidth;\n\t\t\tcx.beginPath();\n\t\t\tif ((d3==1)&&!this.isCross(x,y-1)) d4=1;else d4=0;\n\t\t\tcx.moveTo(a+r,b+(y==1?r:-(d2>>1)-d3+d4));\n\t\t\tif ((d3==1)&&!this.isCross(x,y+1)) d4=1;else d4=0;\n\t\t\tcx.lineTo(a+r,b+(y==this.DY?r:d+(d2>>1)+d3-d4));\n\t\t\tcx.stroke();\n\t\t\tcx.lineWidth=this.lw;\n\t\t\tif (this.borderLineWidth&&((y==1)||(y==this.DY))) cx.lineWidth=this.borderLineWidth;\n\t\t\tcx.beginPath();\n\t\t\tcx.moveTo(a+(x==1?r:0),b+r);\n\t\t\tcx.lineTo(a+(x==this.DX?r:d),b+r);\n\t\t\tcx.stroke();\n\t\t\tcx.lineWidth=this.lw;\n\t\t}\n\t\tif ((m==\"_TB_\")||(m==\"_TW_\"))\n\t\t{\n\t\t\tif ((nat==\"B\")||(nat==\"W\"))\n\t\t\t{\n\t\t\t\tcx.globalAlpha=0.5;\n\t\t\t\tcx.drawImage(this.img[nat],a,b,d,d);\n\t\t\t\tcx.globalAlpha=1;\n\t\t\t}\n\t\t\tcx.drawImage(this.imgSmall[(m==\"_TW_\")?\"W\":\"B\"],a+d\/4,b+d\/4,1+d>>1,1+d>>1);\n\t\t}\n\t\telse if (v&&this.variationEmphasisOn) this.drawVariationEmphasis(cx,a,b,d,x,y,m);\n\t\telse if (this.star(x,y)) this.drawStar(cx,a,b,r);\n\t}\n\telse\n\t{\n\t\tif (!v&&((nat==\"B\")||(nat==\"W\"))) cx.drawImage(this.img[nat],a,b,d,d);\n\t\tif (m)\n\t\t{\n\t\t\tif (this.hasC(\"Diagram\"))\n\t\t\t{\n\t\t\t\tif (this.isLabel(m)) {l=1;m=this.removeLabelDelimiters(m);}\n\t\t\t\telse if ((m==\"_MA_\")||(m==\"_TR_\")||(m==\"_SQ_\")||(m==\"_CR_\")) mtsc=1;\n\t\t\t}\n\t\t\tc=this.drawPointColor(x,y,nat,v,l,mtsc);\n\t\t\tif (mtsc)\n\t\t\t{\n\t\t\t\tcx.strokeStyle=c;\n\t\t\t\tcx.lineWidth=this.markLineWidth?this.markLineWidth:this.lw;\n\t\t\t\tswitch(m)\n\t\t\t\t{\n\t\t\t\t\tcase \"_MA_\":this.drawMark(cx,a,b,d);break;\n\t\t\t\t\tcase \"_TR_\":this.drawTriangle(cx,a,b,d);break;\n\t\t\t\t\tcase \"_SQ_\":this.drawSquare(cx,a,b,d);break;\n\t\t\t\t\tcase \"_CR_\":this.drawCircle(cx,a,b,d);break;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif (m==\"_ML_\") this.drawMarkOnLast(cx,a,b,d,c);\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t\tif (v&&this.variationOnFocusFontWeight&&this.isNextMove(x,y)) fw=this.variationOnFocusFontWeight;\n\t\t\t\t\t\telse if (v&&this.variationFontWeight) fw=this.variationFontWeight;\n\t\t\t\t\t\telse if (l&&this.labelFontWeight) fw=this.labelFontWeight;\n\t\t\t\t\t\telse if ((nat==\"O\")&&this.outsideFontWeight) fw=this.outsideFontWeight;\n\t\t\t\t\t\telse fw=\"normal\";\n\t\t\t\t\t\tif (v&&this.variationOnFocusStrokeColor&&this.isNextMove(x,y)) sc=this.variationOnFocusStrokeColor;\n\t\t\t\t\t\telse if (v&&this.variationStrokeColor) sc=this.variationStrokeColor;\n\t\t\t\t\t\telse sc=0;\n\t\t\t\t\t\tthis.drawText(cx,a,b,d,m,{c:c,fw:fw,sc:sc});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n};\n\nmxG.G.prototype.gobanCnWidth=function(){return (this.xri-this.xli+1)*this.d+2*this.z;};\nmxG.G.prototype.gobanCnHeight=function(){return (this.ybi-this.yti+1)*(this.d+this.d2)+((this.d2)&1?1:0)+2*this.z;};\nmxG.G.prototype.gobanWidth=function(){return this.maximizeGobanWidth?(Math.max(19,this.DX)+((this.configIndicesOn||this.indicesOn)?2:0))*this.d+2*this.z:this.gobanCnWidth();};\nmxG.G.prototype.gobanHeight=function(){return this.maximizeGobanHeight?(Math.max(19,this.DY)+((this.configIndicesOn||this.indicesOn)?2:0))*(this.d+this.d2)+((this.d2)&1?1:0)+2*this.z:this.gobanCnHeight();};\nmxG.G.prototype.gobanLeft=function(){return (this.gobanWidth()-this.gobanCnWidth())>>1;};\nmxG.G.prototype.gobanTop=function(){return (this.gobanHeight()-this.gobanCnHeight())>>1;};\n\nmxG.G.prototype.setGobanSize=function()\n{\n\tvar g=this.getE(\"GobanDiv\"),i=this.getE(\"InnerGobanDiv\"),cn=this.gcn;\n\tg.style.width=this.gobanWidth()+\"px\";\n\tg.style.height=this.gobanHeight()+\"px\";\n\ti.style.top=this.gobanTop()+\"px\";\n\ti.style.left=this.gobanLeft()+\"px\";\n\ti.style.width=this.gobanCnWidth()+\"px\";\n\ti.style.height=this.gobanCnHeight()+\"px\";\n\tcn.width=this.gobanCnWidth();\n\tcn.height=this.gobanCnHeight();\n};\n\nmxG.G.prototype.drawGoban=function()\n{\n\tif (!this.img.B.canDraw||!this.img.W.canDraw) {setTimeout(this.g+\".drawGoban()\",25);return;}\n\tvar i,j,k;\n\tif (mxG.IsAndroid()) this.hasToDrawWholeGoban=1;\n\tif (this.d!=this.exD) this.hasToDrawWholeGoban=1;\n\tif (this.hasToDrawWholeGoban) {this.dNat=[];this.dStr=[];this.setGobanSize();}\n\tfor (i=this.xl;i<=this.xr;i++)\n\t\tfor (j=this.yt;j<=this.yb;j++)\n\t\t{\n\t\t\tk=this.xy(i,j);\n\t\t\tif ((this.dNat[k]!=this.vNat[k])||(this.dStr[k]!=this.vStr[k])||this.variationEmphasisOn)\n\t\t\t{\n\t\t\t\tthis.dNat[k]=this.vNat[k];\n\t\t\t\tthis.dStr[k]=this.vStr[k];\n\t\t\t\tthis.drawPoint(this.gcx,i,j,this.vNat[k],this.vStr[k]);\n\t\t\t}\n\t\t}\n\tif (this.hasC(\"Diagram\")&&this.indicesOn&&this.hasToDrawWholeGoban)\n\t\tfor (i=this.xli;i<=this.xri;i++)\n\t\t\tfor (j=this.yti;j<=this.ybi;j++)\n\t\t\t\tif (!this.inView(i,j)) this.drawPoint(this.gcx,i,j,\"O\",this.getIndices(i,j));\n\tif (this.hasC(\"Edit\")&&this.selection) this.selectView();\n\tthis.exD=this.d;\n\tthis.hasToDrawWholeGoban=0;\n};\n\nmxG.G.prototype.focusInView=function()\n{\n\tthis.xFocus=Math.min(Math.max(this.xFocus,this.xl),this.xr);\n\tthis.yFocus=Math.min(Math.max(this.yFocus,this.yt),this.yb);\n};\n\nmxG.G.prototype.doFocusGoban=function(ev)\n{\n\t\/\/ warning: all browsers don't manage event order in the same way\n\tif (this.doNotFocusGobanJustAfter) return;\n\tthis.focusInView();\n\tthis.dNat[this.xy(this.xFocus,this.yFocus)]=0;\n\tthis.gobanFocusVisible=1;\n\tthis.drawGoban();\n};\n\nmxG.G.prototype.hideGobanFocus=function()\n{\n\tif (this.inView(this.xFocus,this.yFocus)) this.dNat[this.xy(this.xFocus,this.yFocus)]=0;\n\tthis.gobanFocusVisible=0;\n\tthis.drawGoban();\n\tthis.doNotFocusGobanJustAfter=0;\n};\n\nmxG.G.prototype.doBlur4FocusGoban=function(ev)\n{\n\tthis.hideGobanFocus();\n\tthis.doNotFocusGobanJustAfter=0;\n};\n\nmxG.G.prototype.doMouseDown4FocusGoban=function(ev)\n{\n\tthis.doNotFocusGobanJustAfter=1;\n};\n\nmxG.G.prototype.doContextMenu4FocusGoban=function(ev)\n{\n\tthis.hideGobanFocus();\n};\n\nmxG.G.prototype.doKeydownGoban=function(ev)\n{\n\tvar r=0;\n\tswitch(mxG.GetKCode(ev))\n\t{\n\t\tcase 37:case 72:if (this.gobanFocusVisible) this.xFocus--;r=1;break;\n\t\tcase 39:case 74:if (this.gobanFocusVisible) this.xFocus++;r=1;break;\n\t\tcase 38:case 85:if (this.gobanFocusVisible) this.yFocus--;r=1;break;\n\t\tcase 40:case 78:if (this.gobanFocusVisible) this.yFocus++;r=1;break;\n\t}\n\tif (r)\n\t{\n\t\tthis.focusInView();\n\t\tif (this.hasC(\"Edit\")&&(this.editTool==\"Select\"))\n\t\t{\n\t\t\tif (this.inSelect==2) this.selectGobanArea(this.xFocus,this.yFocus);\n\t\t\telse this.gobanFocusVisible=1;\n\t\t}\n\t\tthis.hasToDrawWholeGoban=1;\n\t\tthis.updateAll();\n\t\tev.preventDefault();\n\t}\n\tthis.lastKeydownOnGoban=r;\n};\n\nmxG.G.prototype.getClassicShadowColor=function(c)\n{\n\tvar c2;\n\tif (c==\"transparent\") c=\"white\";\n\tc2=mxG.Color2Rgba(c);\n\treturn \"rgba(\"+Math.max(0,c2[0]-102)+\",\"+Math.max(0,c2[1]-102)+\",\"+Math.max(0,c2[2]-102)+\",\"+c2[3]\/255+\")\";\n};\n\nmxG.G.prototype.initGoban=function()\n{\n\tvar s,k=this.k,bki;\n\tif (this.gobanFocus)\n\t{\n\t\tthis.xFocus=0;\n\t\tthis.yFocus=0;\n\t\t\/\/ add event listeners to InnerGobanDiv otherwise side effect when a gBox is shown\n\t\tthis.getE(\"InnerGobanDiv\").addEventListener(\"keydown\",function(ev){mxG.D[k].doKeydownGoban(ev);},false);\n\t\tthis.getE(\"InnerGobanDiv\").addEventListener(\"focus\",function(ev){mxG.D[k].doFocusGoban(ev);},false);\n\t\tthis.getE(\"InnerGobanDiv\").addEventListener(\"blur\",function(ev){mxG.D[k].doBlur4FocusGoban(ev);},false);\n\t\tthis.getE(\"InnerGobanDiv\").addEventListener(\"mousedown\",function(ev){mxG.D[k].doMouseDown4FocusGoban(ev);},false);\n\t\tthis.getE(\"InnerGobanDiv\").addEventListener(\"contextmenu\",function(ev){mxG.D[k].doContextMenu4FocusGoban(ev);},false);\n\t}\n\tbki=mxG.GetStyle(this.getE(\"GobanCanvas\"),\"backgroundImage\");\n\tif (!bki&&!(bki==\"none\")) this.gobanBk=\"\";\n\telse if (!this.gobanBk) this.gobanBk=mxG.GetStyle(this.getE(\"GobanCanvas\"),\"backgroundColor\");\n\telse mxG.AddCssRule(\"#\"+this.n+\"GobanCanvas {background-color:\"+this.gobanBk+\";}\");\n\tif (this.gobanBk&&this.classicShadow)\n\t{\n\t\ts=this.getClassicShadowColor(this.gobanBk);\n\t\tmxG.AddCssRule(\".mxIn3d #\"+this.n+\"InnerGobanDiv {box-shadow:1px 1px \"+s+\",2px 2px \"+s+\",3px 3px \"+s+\",4px 4px \"+s+\",8px 8px 16px rgba(0,0,0,0.5);}\");\n\t}\n\tthis.gcn=this.getE(\"GobanCanvas\");\n\tif (mxG.IsMacSafari()) this.gcn.style.webkitFontSmoothing=\"antialiased\"; \/\/ otherwise text background bug\n\tthis.gcx=this.gcn.getContext(\"2d\");\n\tif (!this.lineColor) this.lineColor=mxG.GetStyle(this.gcn,\"color\");\n\tif (this.gobanFocus&&!this.focusColor) this.focusColor=\"#f00\";\n};\n\nmxG.G.prototype.updateGoban=function()\n{\n\tvar i,j,k,x,y,z=-1,m;\n\tif (this.markOnLastOn)\n\t{\n\t\tm=this.gor.play;\n\t\tif (this.gor.getAct(m)==\"\")\n\t\t{\n\t\t\tx=this.gor.getX(m);\n\t\t\ty=this.gor.getY(m);\n\t\t\tif (this.inView(x,y)) z=this.xy(x,y);\n\t\t}\n\t}\n\tfor (i=this.xl;i<=this.xr;i++)\n\t\tfor (j=this.yt;j<=this.yb;j++)\n\t\t{\n\t\t\tif (this.hasC(\"Diagram\")) this.addNatAndNum(i,j,z);\n\t\t\telse\n\t\t\t{\n\t\t\t\tk=this.xy(i,j);\n\t\t\t\tthis.vNat[k]=this.gor.getBanNat(i,j);\n\t\t\t\tthis.vStr[k]=(z==k)?\"_ML_\":\"\";\n\t\t\t}\n\t\t}\n\tif (this.hasC(\"Diagram\")) this.addMarksAndLabels();\n\tif (this.hasC(\"Variations\")) this.addVariationMarks();\n\tthis.drawGoban();\n};\n\nmxG.G.prototype.refreshGoban=function()\n{\n\tif (this.d!=this.exD) this.drawGoban();\n\t\/\/ always resize gBox otherwise sometimes not proper resize\n\tif (this.gBox) this.resizeGBox(this.gBox);\n};\n\nmxG.G.prototype.createGoban=function()\n{\n\tvar s;\n\tthis.goodnessCode={Good:1,Bad:2,Even:4,Warning:8,Unclear:16,OffPath:32};\n\tthis.gobanFocus=(this.hasC(\"Solve\")\n\t\t\t\t   ||this.hasC(\"Variations\")\n\t\t\t\t   ||this.hasC(\"Guess\"))?1:0;\n\tthis.vNat=[];\n\tthis.dNat=[];\n\tthis.vStr=[];\n\tthis.dStr=[];\n\tthis.write(\"<div class=\\\"mxGobanDiv\\\" id=\\\"\"+this.n+\"GobanDiv\\\">\");\n\ts=\"position:relative;outline:none;\";\n\tthis.write(\"<div\"+(this.gobanFocus?\" tabindex=\\\"0\\\"\":\"\")+\" class=\\\"mxInnerGobanDiv\\\" id=\\\"\"+this.n+\"InnerGobanDiv\\\" style=\\\"\"+s+\"\\\">\");\n\t\/\/ -webkit-tap-highlight-color:rgba(0,0,0,0); avoid bad touch effect on mobile\n\t\/\/ -webkit-text-size-adjust:none; avoid minimal font-size effect on mobile chrome\n\ts=\"display:block;position:relative;-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-text-size-adjust:none;\";\n\tthis.write(\"<canvas width=\\\"0\\\" height=\\\"0\\\" style=\\\"\"+s+\"\\\" id=\\\"\"+this.n+\"GobanCanvas\\\">\");\n\tthis.write(\"<\/canvas><\/div><\/div>\");\n};\n\n}\n\/\/ maxiGos v6.49 > mgosVariations.js Copyright 2012-2014 Francois Mizessyn, BSD license (see license.txt)\n\nif (typeof mxG.G.prototype.createVariations=='undefined'){\n\nif (mxG.L==\"fr\")\n{\n\tmxG.Z[\"Variations: \"]=\"Variations : \";\n\tmxG.Z[\"no variation\"]=\"aucune\";\n}\n\nmxG.G.prototype.setMode=function()\n{\n\tthis.styleMode=parseInt(this.getInfo(\"ST\"));\n\tif (this.configVariationMarksOn===undefined) this.variationMarksOn=(this.styleMode&2)?0:1;\n\telse\n\t{\n\t\tif (this.variationMarksOn) this.styleMode&=~2;\n\t\telse this.styleMode|=2;\n\t}\n\tif (this.configSiblingsOn===undefined) this.siblingsOn=(this.styleMode&1)?1:0;\n\telse\n\t{\n\t\tif (this.siblingsOn) this.styleMode|=1;\n\t\telse this.styleMode&=~1;\n\t}\n\tif (this.hideSingleVariationMarkOn) this.styleMode|=4;\n};\n\nmxG.G.prototype.doClickVariationInBox=function(a)\n{\n\tvar aN=this.styleMode&1?this.cN.Dad:this.cN;\n\tif (this.styleMode&1) this.backNode(aN);\n\taN.Focus=a+1;\n\tthis.placeNode();\n\tthis.updateAll();\n\tthis.setFocus();\n};\n\nmxG.G.prototype.addVariationMarkInBox=function(a,m)\n{\n\tvar i=document.createElement(\"input\"),k=this.k;\n\tif (this.hasC(\"Diagram\")&&this.isLabel(m)) m=this.removeLabelDelimiters(m);\n\ti.type=\"button\";\n\ti.value=m;\n\ti.addEventListener(\"click\",function(ev){mxG.D[k].doClickVariationInBox(a);},false);\n\tthis.getE(\"VariationsDiv\").appendChild(i);\n};\n\nmxG.G.prototype.buildVariationMark=function(l)\n{\n\tif (this.variationMarkSeed) return String.fromCharCode(this.variationMarkSeed.charCodeAt(0)-1+l);\n\telse return l+\"\";\n};\n\nmxG.G.prototype.addVariationMarks=function()\n{\n\tvar aN,s,k,km,l=0,x,y,z,m,e=this.getE(\"VariationsDiv\"),s1=\"<span class=\\\"mxVariationsSpan\\\">\"+this.local(\"Variations: \")+\"<\/span>\",s2=\"<span class=\\\"mxNoVariationSpan\\\">\"+this.local(\"no variation\")+\"<\/span>\";\n\tif (this.variationsBoxOn) e.innerHTML=s1;\n\tif (this.styleMode&1)\n\t{\n\t\tif (!this.cN||!this.cN.Dad) \n\t\t{\n\t\t\tif (this.variationsBoxOn) e.innerHTML=s1+s2;\n\t\t\treturn;\n\t\t}\n\t\taN=this.cN.Dad;\n\t}\n\telse\n\t{\n\t\tif (!this.cN||!this.cN.KidOnFocus())\n\t\t{\n\t\t\tif (this.variationsBoxOn) e.innerHTML=s1+s2;\n\t\t\treturn;\n\t\t}\n\t\taN=this.cN;\n\t}\n\tkm=aN.Kid.length;\n\tif ((this.styleMode&4)&&(km==1))\n\t{\n\t\tif (this.variationsBoxOn) e.innerHTML=s1+s2;\n\t\treturn;\n\t}\n\tfor (k=0;k<km;k++)\n\t\tif (aN.Kid[k]!=this.cN)\n\t\t{\n\t\t\ts=\"\";\n\t\t\tl++;\n\t\t\tif (aN.Kid[k].P.B) s=aN.Kid[k].P.B[0];\n\t\t\telse if (aN.Kid[k].P.W) s=aN.Kid[k].P.W[0];\n\t\t\tif (s.length==2)\n\t\t\t{\n\t\t\t\tx=s.c2n(0);\n\t\t\t\ty=s.c2n(1);\n\t\t\t\tz=this.xy(x,y);\n\t\t\t\tif (this.inView(x,y)) m=this.vStr[z];else m=this.buildVariationMark(l);\n\t\t\t\tif ((m+\"\").search(\/^\\((.*)\\)$\/)==-1)\n\t\t\t\t{\n\t\t\t\t\tif (!m) m=this.buildVariationMark(l);\n\t\t\t\t\tif (!(this.styleMode&2)&&(!(this.styleMode&1)||(aN.Kid[k]!=this.cN))) this.vStr[z]=\"(\"+m+\")\";\n\t\t\t\t}\n\t\t\t\tif ((m+\"\").search(\/^_.*_$\/)==0) m=this.buildVariationMark(l);\n\t\t\t}\n\t\t\telse m=this.buildVariationMark(l);\n\t\t\tif (this.variationsBoxOn&&(aN.Kid[k]!=this.cN)) this.addVariationMarkInBox(k,m);\n\t\t}\n};\n\nmxG.G.prototype.isVariation=function(m)\n{\n\treturn m.search(\/^\\((.*)\\)$\/)>-1;\n};\n\nmxG.G.prototype.removeVariationDelimiters=function(m)\n{\n\treturn m.replace(\/^(\\()+(.*)(\\))+$\/,\"$2\");\n};\n\nmxG.G.prototype.getVariationNextNat=function()\n{\n\tvar aN,k,km;\n\t\/\/ get color from PL\n\taN=this.cN;\n\tif (aN.P.PL) return aN.P.PL[0];\n\t\/\/ get color of cN.KidOnFocus()\n\taN=this.cN.KidOnFocus();\n\tif (aN)\n\t{\n\t\tif (aN.P.B) return \"B\";\n\t\tif (aN.P.W) return \"W\";\n\t}\n\t\/\/ get opposite color of cN\n\taN=this.cN;\n\tif (aN.P.B) return \"W\";\n\tif (aN.P.W) return \"B\";\n\t\/\/ get opposite color if cN has AB and no AW (handicap game?) or AW and no AB, \n\tif (aN.P.AB&&!aN.P.AW) return \"W\";\n\telse if (aN.P.AW&&!aN.P.AB) return \"B\";\n\t\/\/ get color of cN children\n\tkm=this.cN.Kid.length;\n\tfor (k=0;k<km;k++)\n\t{\n\t\taN=this.cN.Kid[k];\n\t\tif (aN.P.B) return \"B\";\n\t\tif (aN.P.W) return \"W\";\n\t}\n\t\/\/ get opposite color of cN brothers\n\tkm=this.cN.Dad.Kid.length;\n\tfor (k=0;k<km;k++)\n\t{\n\t\taN=this.cN.Dad.Kid[k];\n\t\tif (aN.P.B) return \"W\";\n\t\tif (aN.P.W) return \"B\";\n\t}\n\t\/\/ unable to decide who will play\n\treturn \"B\";\n};\n\nmxG.G.prototype.addVariationPlay=function(aP,x,y)\n{\n\tvar aN,aV=this.xy2s(x,y);\n\taN=this.cN.N(aP,aV);\n\taN.Add=1;\n\tthis.cN.Focus=this.cN.Kid.length;\n};\n\nmxG.G.prototype.checkBW=function(aN,a,b)\n{\n\tvar s=\"\",x,y;\n\tif (aN.P.B||aN.P.W)\n\t{\n\t\tif (aN.P.B) s=aN.P.B[0];else s=aN.P.W[0];\n\t\tif (s.length==2) {x=s.c2n(0);y=s.c2n(1);}\n\t\telse {x=0;y=0;}\n\t\treturn (x==a)&&(y==b);\n\t}\n\treturn 0;\n};\n\nmxG.G.prototype.checkAX=function(aN,a,b)\n{\n\tvar AX=[\"AB\",\"AW\",\"AE\"];\n\tvar s,x,y,aP,z,k,aLen,x1,x2,y1,y2;\n\ts=\"\";\n\tif (aN.P.AB) aP=\"AB\";\n\telse if (aN.P.AW) aP=\"AW\";\n\telse if (aN.P.AE) aP=\"AE\";\n\telse aP=0;\n\tif (aP) for (z=0;z<3;z++)\n\t{\n\t\taP=AX[z];\n\t\tif (aN.P[aP])\n\t\t{\n\t\t\taLen=aN.P[aP].length;\n\t\t\tfor (k=0;k<aLen;k++)\n\t\t\t{\n\t\t\t\ts=aN.P[aP][k];\n\t\t\t\tif (s.length==2)\n\t\t\t\t{\n\t\t\t\t\tx=s.c2n(0);\n\t\t\t\t\ty=s.c2n(1);\n\t\t\t\t\tif ((x==a)&&(y==b)) return 1;\n\t\t\t\t}\n\t\t\t\telse if (s.length==5)\n\t\t\t\t{\n\t\t\t\t\tx1=s.c2n(0);\n\t\t\t\t\ty1=s.c2n(1);\n\t\t\t\t\tx2=s.c2n(3);\n\t\t\t\t\ty2=s.c2n(4);\n\t\t\t\t\tfor (x=x1;x<=x2;x++) for (y=y1;y<=y2;y++) if ((x==a)&&(y==b)) return 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn 0;\n};\n\nmxG.G.prototype.checkVariation=function(a,b)\n{\n\tvar aN,bN,k,km,ok=0;\n\tif ((this.styleMode&1)&&(this.cN.Dad==this.rN)) {this.plonk();return;}\n\tif (a&&b&&this.gor.isOccupied(a,b))\n\t{\n\t\taN=this.cN.Dad;\n\t\twhile (!ok&&(aN!=this.rN))\n\t\t{\n\t\t\tif (this.checkBW(aN,a,b)||this.checkAX(aN,a,b)) ok=1;\n\t\t\telse aN=aN.Dad;\n\t\t}\n\t\tif (ok)\n\t\t{\n\t\t\tthis.backNode(aN);\n\t\t\tthis.updateAll();\n\t\t}\n\t\treturn;\n\t}\n\taN=this.styleMode&1?this.cN.Dad:this.cN;\n\tkm=aN.Kid.length;\n\tfor (k=0;k<km;k++)\n\t{\n\t\tbN=aN.Kid[k];\n\t\tif (this.checkBW(bN,a,b))\n\t\t{\n\t\t\tif (this.styleMode&1) this.backNode(aN);\n\t\t\taN.Focus=k+1;\n\t\t\tthis.placeNode();\n\t\t\tthis.updateAll();\n\t\t\treturn;\n\t\t}\n\t}\n\t\/\/ (a,b) not in the sgf, thus add it and play it\n\t\/\/ but don't add anything if (this.styleMode&1) since it leads to a mess\n\tif (this.styleMode&1) {this.plonk();return;}\n\tthis.addVariationPlay(this.getVariationNextNat(),a,b);\n\tthis.placeNode();\n\tif (this.hasC(\"Tree\")) this.addNodeInTree(this.cN);\n\tthis.updateAll();\n};\n\nmxG.G.prototype.doClickVariations=function(ev)\n{\n\tif (this.canPlaceVariation)\n\t{\n\t\tvar c=this.getC(ev);\n\t\tthis.setFocus();\n\t\tif (!this.inView(c.x,c.y)) {this.plonk();return;}\n\t\tthis.checkVariation(c.x,c.y);\n\t}\n};\n\nmxG.G.prototype.doKeydownGobanForVariations=function(ev)\n{\n\tif (this.canPlaceVariation)\n\t\tif (mxG.GetKCode(ev)==13) this.checkVariation(this.xFocus,this.yFocus);\n};\n\nmxG.G.prototype.initVariations=function()\n{\n\tvar el=this.getE(\"GobanCanvas\"),k=this.k;\n\tel.getMClick=mxG.GetMClick;\n\tel.addEventListener(\"click\",function(ev){mxG.D[k].doClickVariations(ev);},false);\n\tif (this.gobanFocus) this.getE(\"GobanDiv\").addEventListener(\"keydown\",function(ev){mxG.D[k].doKeydownGobanForVariations(ev);},false);\n};\n\nmxG.G.prototype.refreshVariations=function()\n{\n\tif (this.variationsBoxOn&&this.adjustVariationsWidth)\n\t{\n\t\tvar e=this.getE(\"VariationsDiv\");\n\t\te.style.width=(this.gobanWidth()+this.getDW(this.getE(\"GobanDiv\"))-this.getDW(e))+\"px\";\n\t}\n};\n\nmxG.G.prototype.createVariations=function()\n{\n\tif (!this.hasC(\"Edit\"))\n\t{\n\t\tthis.configVariationMarksOn=this.variationMarksOn;\n\t\tthis.configSiblingsOn=this.siblingsOn;\n\t}\n\tif (this.variationsBoxOn) this.write(\"<div class=\\\"mxVariationsDiv\\\" id=\\\"\"+this.n+\"VariationsDiv\\\"><\/div>\");\n};\n\n}\n\/\/ maxiGos v6.49 > mgosNavigation.js Copyright 2002-2014 Francois Mizessyn, BSD license (see license.txt)\n\nif (typeof mxG.G.prototype.createNavigation=='undefined'){\n\nmxG.G.prototype.doFirst=function()\n{\n\tthis.backNode(this.rN.KidOnFocus());\n\tthis.updateAll();\n};\n\nmxG.G.prototype.doTenPred=function()\n{\n\tvar k,aN=this.cN;\n\tfor (k=0;k<10;k++)\n\t{\n\t\tif (aN.Dad!=this.rN) aN=aN.Dad;else break;\n\t\tif (this.hasC(\"Variations\")&&!(this.styleMode&2))\n\t\t{\n\t\t\tif (this.styleMode&1) {if (aN.Dad.Kid.length>1) break;}\n\t\t\telse if (aN.Kid.length>1) break;\n\t\t}\n\t}\n\tthis.backNode((aN==this.rN)?aN.KidOnFocus():aN);\n\tthis.updateAll();\n};\n\nmxG.G.prototype.doPred=function()\n{\n\tvar aN=this.cN.Dad;\n\tthis.backNode((aN==this.rN)?aN.KidOnFocus():aN);\n\tthis.updateAll();\n};\n\nmxG.G.prototype.doNext=function()\n{\n\tthis.placeNode();\n\tthis.updateAll();\n};\n\nmxG.G.prototype.doTenNext=function()\n{\n\tfor (var k=0;k<10;k++)\n\t{\n\t\tif (this.cN.KidOnFocus()) this.placeNode();else break;\n\t\tif (this.hasC(\"Variations\")&&!(this.styleMode&2))\n\t\t{\n\t\t\t\/\/ break if some variation are found\n\t\t\tif (this.styleMode&1) {if (this.cN.Dad.Kid.length>1) break;}\n\t\t\telse if (this.cN.Kid.length>1) break;\n\t\t}\n\t}\n\tthis.updateAll();\n};\n\nmxG.G.prototype.doLast=function()\n{\n\twhile (this.cN.KidOnFocus()) this.placeNode();\n\tthis.updateAll();\n};\n\nmxG.G.prototype.doTopVariation=function()\n{\n\tvar aN,k,km;\n\tif (this.styleMode&1) aN=this.cN.Dad;else aN=this.cN;\n\tk=aN.Focus;\n\tkm=aN.Kid.length;\n\tif (km>1)\n\t{\n\t\taN.Focus=(k>1)?k-1:km;\n\t\tif (this.styleMode&1) this.backNode(aN.KidOnFocus());\n\t\tthis.hasToDrawWholeGoban=1;\n\t\tthis.updateAll();\n\t}\n};\n\nmxG.G.prototype.doBottomVariation=function()\n{\n\tvar aN,bN,k,km;\n\tif (this.styleMode&1) aN=this.cN.Dad;else aN=this.cN;\n\tk=aN.Focus;\n\tkm=aN.Kid.length;\n\tif (km>1)\n\t{\n\t\taN.Focus=(k<km)?k+1:1;\n\t\tif (this.styleMode&1) this.backNode(aN.KidOnFocus());\n\t\tthis.hasToDrawWholeGoban=1;\n\t\tthis.updateAll();\n\t}\n};\n\nmxG.G.prototype.drawArrow=function(cx,x,y,d,s)\n{\n\tcx.beginPath();\n\tif (s==\"L\") {cx.moveTo(x,y+d\/2);cx.lineTo(x+d\/2,y);cx.lineTo(x+d\/2,y+d);cx.lineTo(x,y+d\/2);}\n\telse {cx.moveTo(x+d\/2,y+d\/2);cx.lineTo(x,y);cx.lineTo(x,y+d);cx.lineTo(x+d\/2,y+d\/2);}\n\tcx.closePath();\n\tcx.fill();\n};\n\nmxG.G.prototype.drawBar=function(cx,x,y,d)\n{\n\tcx.fillRect(x,y,d\/8,d);\n};\n\nmxG.G.prototype.drawNavigationBtn=function(b)\n{\n\tvar h,w,m,cn,cx,c;\n\tcn=this.getE(b+\"Cn\");\n\tif (!cn.width&&this.navigationBtnFs) {cn.style.fontSize=this.navigationBtnFs;}\n\th=mxG.GetPxrStyle(cn,\"fontSize\");\n\tw=1.5*h;\n\tm=(w-h)\/2;\n\tcn.height=h;\n\tcn.width=w;\n\tcx=cn.getContext(\"2d\");\n\tif (c=this.navigationBtnColor) this[b+\"BtnColor\"]=c;\n\tif (!this[b+\"BtnColor\"]) this[b+\"BtnColor\"]=mxG.GetStyle(cn,\"color\"); \/\/ button enabled?\n\tcx.fillStyle=this[b+\"BtnColor\"];\n\tswitch(b)\n\t{\n\t\tcase \"First\": this.drawBar(cx,m+h\/8,0,h);this.drawArrow(cx,m+h\/4+h\/8,0,h,\"L\");break;\n\t\tcase \"TenPred\": this.drawArrow(cx,m,0,h,\"L\");this.drawArrow(cx,m+h\/2,0,h,\"L\");break;\n\t\tcase \"Pred\": this.drawArrow(cx,m+h\/4,0,h,\"L\");break;\n\t\tcase \"Next\": this.drawArrow(cx,m+h\/4,0,h,\"R\");break;\n\t\tcase \"TenNext\": this.drawArrow(cx,m,0,h,\"R\");this.drawArrow(cx,m+h\/2,0,h,\"R\");break;\n\t\tcase \"Last\": this.drawArrow(cx,m+h\/8,0,h,\"R\");this.drawBar(cx,m+h\/2+h\/4,0,h);break;\n\t}\n};\n\nmxG.G.prototype.doKeydownNavigation=function(ev)\n{\n\tvar r=0;\n\tswitch(mxG.GetKCode(ev))\n\t{\n\t\tcase 36:case 70:this.doFirst();r=1;break;\n\t\tcase 33:case 71:this.doTenPred();r=1;break;\n\t\tcase 37:case 72:this.doPred();r=1;break;\n\t\tcase 39:case 74:this.doNext();r=1;break;\n\t\tcase 34:case 75:this.doTenNext();r=1;break;\n\t\tcase 35:case 76:this.doLast();r=1;break;\n\t\tcase 38:case 85:this.doTopVariation();r=1;break;\n\t\tcase 40:case 78:this.doBottomVariation();r=1;break;\n\t}\n\tif (r) ev.preventDefault();\n};\n\nmxG.G.prototype.initNavigation=function()\n{\n\tvar k=this.k;\n\tthis.getE(\"NavigationDiv\").addEventListener(\"keydown\",function(ev){mxG.D[k].doKeydownNavigation(ev);},false);\n\tfor (var b=0;b<6;b++) this.drawNavigationBtn(this.bNav[b]);\n};\n\nmxG.G.prototype.updateNavigation=function()\n{\n\tif (this.cN.Kid.length)\n\t{\n\t\tthis.enableBtn(\"Next\");\n\t\tthis.enableBtn(\"TenNext\");\n\t\tthis.enableBtn(\"Last\");\n\t}\n\telse\n\t{\n\t\tthis.disableBtn(\"Next\");\n\t\tthis.disableBtn(\"TenNext\");\n\t\tthis.disableBtn(\"Last\");\n\t}\n\tif (this.cN.Dad==this.rN)\n\t{\n\t\tthis.disableBtn(\"First\");\n\t\tthis.disableBtn(\"Pred\");\n\t\tthis.disableBtn(\"TenPred\");\n\t}\n\telse\n\t{\n\t\tthis.enableBtn(\"First\");\n\t\tthis.enableBtn(\"Pred\");\n\t\tthis.enableBtn(\"TenPred\");\n\t}\n};\n\nmxG.G.prototype.refreshNavigation=function()\n{\n\tvar k,b,e,g,w,h,m;\n\tif (this.adjustNavigationWidth)\n\t{\n\t\te=this.getE(\"NavigationDiv\");\n\t\tg=this.getE(\"GobanDiv\");\n\t\tw=this.gobanWidth()+this.getDW(g)-this.getDW(e);\n\t\tif (w!=this.lastNavW) {this.lastNavW=w;e.style.width=w+\"px\";}\n\t}\n\tif (this.fitParent&2)\n\t{\n\t\t\/\/ compute h (button height) and m (space between buttons) to fit goban width (a 19x19 one)\n\t\th=Math.floor(this.d);\n\t\tm=Math.floor(0.6*h);\n\t\tif ((h!=this.lastNavBtnH)||(m!=this.lastNavBtnM))\n\t\t{\n\t\t\tthis.lastNavBtnH=h;\n\t\t\tthis.lastNavBtnM=m;\n\t\t\tfor (k=0;k<6;k++)\n\t\t\t{\n\t\t\t\te=this.getE(this.bNav[k]+\"Cn\").parentNode;\n\t\t\t\te.style.fontSize=h+\"px\";\n\t\t\t\te.style.paddingLeft=m+\"px\";\n\t\t\t\te.style.paddingRight=m+\"px\";\n\t\t\t}\n\t\t}\n\t}\n\tfor (k=0;k<6;k++)\n\t{\n\t\tb=this.bNav[k];\n\t\tif (mxG.GetPxrStyle(this.getE(b+\"Cn\"),\"fontSize\")!=this.getE(b+\"Cn\").height)\n\t\t\tthis.drawNavigationBtn(b);\n\t}\n};\n\nmxG.G.prototype.createNavigation=function()\n{\n\tif (this.fitParent&2)\n\t{\n\t\tthis.adjustNavigationWidth=1;\n\t\tmxG.AddCssRule(\"#\"+this.n+\"NavigationDiv {margin-left:auto;margin-right:auto;}\");\n\t\tmxG.AddCssRule(\"#\"+this.n+\"NavigationDiv button {margin-left:0;margin-right:0;border:0;}\");\n\t\t\/\/ cannot insert line below: crash on webkit\n\t\t\/\/ mxG.AddCssRule(\"#\"+this.n+\"NavigationDiv button::-moz-focus-inner {padding:0;border:0;}\");\n\t}\n\tthis.bNav=[\"First\",\"TenPred\",\"Pred\",\"Next\",\"TenNext\",\"Last\"];\n\tthis.write(\"<div tabindex=\\\"-1\\\" style=\\\"outline:none;\\\" class=\\\"mxNavigationDiv\\\" id=\\\"\"+this.n+\"NavigationDiv\\\">\");\n\tfor (var b=0;b<6;b++) this.addBtn({n:this.bNav[b]});\n\tthis.write(\"<\/div>\");\n};\n\n}\n\n\/\/ maxiGos v6.47 > mgosVersion.js Copyright 2012-2014 Francois Mizessyn, BSD license (see license.txt)\n\nif (typeof mxG.G.prototype.createVersion=='undefined'){\n\nmxG.G.prototype.createVersion=function()\n{\n\tif (this.versionBoxOn===undefined) this.versionBoxOn=1;\n\tif (this.versionBoxOn)\n\t{\n\t\tthis.write(\"<div class=\\\"mxVersionDiv\\\" id=\\\"\"+this.n+\"VersionDiv\\\">\");\n\t\tthis.write(\"<span>maxiGos \"+mxG.V+\"<\/span>\");\n\t\tthis.write(\"<\/div>\");\n\t}\n};\n\n}\nmxG.AddCss(\"http:\/\/njet.oops.jp\/wordpress\/wp-content\/plugins\/maxigos_wp_plugin\/_maxigos\/_mgos\/_css\/basic.css\");\nmxG.K++;\nmxG.D[mxG.K]=new mxG.G(mxG.K);\nmxG.D[mxG.K].path=\"http:\/\/njet.oops.jp\/wordpress\/wp-content\/plugins\/maxigos_wp_plugin\/_maxigos\/\";\nmxG.D[mxG.K].b[0]={n:\"Box\",c:[\"Goban\",\"Variations\",\"Navigation\",\"Version\"]};\nmxG.D[mxG.K].globalBox=\"BasicGlobalBox\";\nmxG.D[mxG.K].markOnLastOn=1;\nmxG.D[mxG.K].in3dOn=1;\nmxG.D[mxG.K].stretchOn=1;\nmxG.D[mxG.K].initMethod=\"last\";\nmxG.D[mxG.K].sgfLoadCoreOnly=1;\nmxG.D[mxG.K].sgfLoadMainOnly=0;\nmxG.D[mxG.K].variationColor=\"#fff\";\nmxG.D[mxG.K].variationBk=\"#cc8a24\";\nmxG.D[mxG.K].variationOnFocusBk=\"#965400\";\nmxG.D[mxG.K].variationFontWeight=\"bold\";\nmxG.D[mxG.K].variationsBoxOn=0;\nmxG.D[mxG.K].hideSingleVariationMarkOn=1;\nmxG.D[mxG.K].variationMarksOn=1;\nmxG.D[mxG.K].canPlaceVariation=1;\nmxG.D[mxG.K].siblingsOn=0;\nmxG.D[mxG.K].classicShadow=1;\n(function(){var n=mxG.D[mxG.K].rN,v=[];\n})();\nmxG.D[mxG.K].createAll();\n<\/script>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[35],"tags":[],"class_list":["post-3842","post","type-post","status-publish","format-standard","hentry","category-35"],"_links":{"self":[{"href":"https:\/\/njet.oops.jp\/wordpress\/wp-json\/wp\/v2\/posts\/3842","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/njet.oops.jp\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/njet.oops.jp\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/njet.oops.jp\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/njet.oops.jp\/wordpress\/wp-json\/wp\/v2\/comments?post=3842"}],"version-history":[{"count":2,"href":"https:\/\/njet.oops.jp\/wordpress\/wp-json\/wp\/v2\/posts\/3842\/revisions"}],"predecessor-version":[{"id":3844,"href":"https:\/\/njet.oops.jp\/wordpress\/wp-json\/wp\/v2\/posts\/3842\/revisions\/3844"}],"wp:attachment":[{"href":"https:\/\/njet.oops.jp\/wordpress\/wp-json\/wp\/v2\/media?parent=3842"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/njet.oops.jp\/wordpress\/wp-json\/wp\/v2\/categories?post=3842"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/njet.oops.jp\/wordpress\/wp-json\/wp\/v2\/tags?post=3842"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}