围棋打谱

围棋棋谱播放:)

<style type="text/css">
body {/*背景样式*/
 background-color: #FFD700;
}
.W{/*白棋样式*/
    FILTER: DropShadow(Color=#ff0000, OffX=1, OffY=1, Positive=1);
 font-size:24px;
 cursor:hand;
 color:#FFFFFF;
}
.B{/*黑棋样式*/
    FILTER: DropShadow(Color=#ff0000, OffX=1, OffY=1, Positive=1);
 font-size:24px;
 cursor:hand;
 color:#000000;

}
.N{/*无棋子样式*/
font-size:24px;
cursor:hand;
ont-size:0px;
filter: Alpha(Opacity=0, FinishOpacity=0, Style=1, StartX=0, StartY=0, FinishX=0, FinishY=0);

}
.btn{/*按钮样式*/
font-family:"Wingdings"
cursor:hand;
Width:80%;
 font-family: Webdings;
}
</style>
<body>
 <%arr=array("New","Play","Slow","Fast","Back","ForWord","Pause","Stop")
 sub Mywrite(n,S,Cls)
    for i=1 to n%>
  <tr><%for j=1 to n%>
   <td <%=Cls%>><%=S%></td>    
  <%next%>
</tr><%next
end sub%>
<table width="100%"  border="2" cellspacing="0" cellpadding="0">
<tr>
<td width="600" height="600" align="center" bgcolor="#a0522d">
    <table  width="540" height="540" border="1"   cellpadding="0"
 cellspacing="0" bordercolor="#000000"     >
<%Mywrite 18,"&nbsp;",""%>     
</table></td>
     <td align="center" valign="top" id=td1>
     <textarea name="T_SGF" style="width:100%;height:400">
     <!--#include file="13asiacup-2-2.sgf"--></textarea><p></p>
<table width="80%"  border="0" cellspacing="0" cellpadding="0" >
     <tr><%for i=53 to 60%>   <td > 
<button  class="btn" title="<%=arr(i-53)%>" οnclick="vbs:sub_<%=arr(i-53)%>"><%=chr(i)%></button>
 </td>
<%next%></tr>
     <tr><%for i=53 to 60%>    
   <td style="font-size:9;" width="12%" align="center"><%=arr(i-53)%></td>
<%next%></tr>
    <table>
</td>
  </tr>
</table>
  <DIV STYLE="position:absolute;  left: 30px; top: 35;">
   <table id=QiP width="570" height="570" border="0" cellpadding="0"
   cellspacing="0" >    
<%Mywrite 19,"●","class='N'"%>      
   </table>
</DIV>
</body>
<SCRIPT LANGUAGE="vbscript" >
'作者:笨狼
'支持判断死活的提子功能
Dim Arr_SGF'定义全局步数坐标数组
Dim SGF_Step:SGF_Step=0'定义总步数
Dim Total_Step'定义全局变量演示步数
Dim SGF_Time:SGF_Time=1'定义全局变量延迟时间,默认1秒
Dim intervalID'定义起停标记
Dim Arr_Conn()'定义棋连通权值数组,空为没判断过,0为敌方棋子,1为连通
Sub sub_New
 sub_Stop
 Dim SGF:SGF=T_SGF.value
 
 Dim SGF_Head:SGF_Head=split(SGF,";B[")(0)'定义头字串
 Dim SGF_End:SGF_End="])"'定义尾字串
 SGF=right(SGF,len(SGF)-len(SGF_head)-3)'去掉头
 SGF=left(SGF,len(SGF)-len(SGF_End))'去掉尾
 SGF=replace(SGF," ","")'去掉空格
 SGF=replace(SGF,chr(13),"")'去掉回车
 SGF=replace(SGF,chr(10),"")'去掉不可见字符
 SGF=replace(SGF,"];W["," ")'替换成空格
 SGF=replace(SGF,"];B["," ")'替换成空格  
 Arr_tempSGF=split(SGF)'定义局部数组
 dim i:i=0
 for each xy in Arr_tempSGF
  '转换成坐标数字"X Y"格式
  xy= asc(right(xy,1))-97 & " " & asc(left(xy,1))-97
  Arr_tempSGF(i)=xy
  i=i+1
 next
 Arr_SGF=Arr_tempSGF'返回数组Array("4 3","14 15") 格式
 Total_Step=Ubound(Arr_SGF)
end sub

sub sub_Play
'功能:延迟显示步数坐标数组 
 sub_ForWord
 sub_Pause'先停止 
 intervalID=window.setTimeout("sub_Play",SGF_Time * 1000,"vbs")
end sub
sub sub_Slow
'功能:放慢速度
 SGF_Time=SGF_Time*2
end sub
sub sub_Fast
'功能:加快速度
 if SGF_Time>1 then SGF_Time=SGF_Time/2
end sub
sub sub_Back
'功能:后退
 If isempty(Arr_SGF) then sub_New
 sub_Pause'先停止
 if SGF_Step=0 then exit sub
 SGF_Step=SGF_Step-1  
 Dim xx:xx=cint(split(Arr_SGF(SGF_Step))(0))'横坐标
 Dim yy:yy=cint(split(Arr_SGF(SGF_Step))(1))'纵坐标  
 QiP.rows(xx).Cells(yy).className="N" 
end sub
sub sub_ForWord
'前进 
 If isempty(Arr_SGF) then sub_New
 Dim xxx:xxx=cint(split(Arr_SGF(SGF_Step))(0))'横坐标
 Dim yyy:yyy=cint(split(Arr_SGF(SGF_Step))(1))'纵坐标 
 if SGF_Step mod 2=0 then 
  QiP.rows(xxx).Cells(yyy).className="B"  
 else
  QiP.rows(xxx).Cells(yyy).className="W"  
 end if
 sub_Eat'判断死活
 SGF_Step=SGF_Step+1
 if SGF_Step=Total_Step then
  '如果全部播放完毕,重播
  sub_Stop  
 end if
 
end sub
sub sub_Pause 
 window.clearTimeout intervalID
end sub
sub sub_Stop
 sub_Pause
 SGF_Step=0'步数归0  
  for each rrr in QiP.rows
    for each ccc in rrr.cells
   ccc.className="N"
    next
  next 
end sub
sub sub_Eat  
 redim Arr_Conn(18,18)'定义棋连通权值数组,空为没判断过,0为敌方棋子,1为连通
 '空地的标准:className="N"
 '连通的标准:1,与空地直接连通。
 '连通的标准:2,通过(与空地连通的同色棋子)与空地若干次间接连通
 
 Dim x:x=0:Dim y:y=0'坐标
 Dim i,j'循环用的数字 
 for i=0 to 18   
  for j=0 to 18   
   if QiP.rows(i).cells(j).className="N" and isempty(Arr_Conn(i,j)) then
    x=i:y=j    
    '找到所有没判断过的空地,作为判断死活的起点
     Sub_Conn x ,y,x,y-1 '上x,y-1; 
     Sub_Conn x ,y,x,y+1 '下x,y+1
     Sub_Conn x ,y,x-1,y '左x-1,y
     Sub_Conn x ,y,x+1,y '右x+1,y
   end if
   next
 next 
 '判断死活
 '黑棋死的标准:样式为"B",连通为空
 '白棋死的标准:样式为"W",连通为空
 
 for i=0 to 18   
  for j=0 to 18
   select case SGF_Step mod 2
    case 0'黑棋吃白棋
     if isempty(Arr_Conn(i,j)) and QiP.rows(i).cells(j).className="W" Then
      QiP.rows(i).cells(j).className="N"      
     end if
    case 1'白棋吃黑棋 
     if isempty(Arr_Conn(i,j)) and QiP.rows(i).cells(j).className="B" Then
      QiP.rows(i).cells(j).className="N"      
     end if
   end select
   next
 next
end sub

sub Sub_Conn(x,y,Target_x,Target_y) 
 '功能:判断是否可以前行
 '输入条件1,2:自己坐标 '输入条件3,4:目标坐标
  '1:身处悬崖边,目标位置在棋盘外
 Arr_Conn(x,y)=1 '到此一游 
 if  Target_x>18 or Target_x<0  or Target_y>18 or Target_y<0 then  
  exit Sub  '此路不通,不再判断
 end if
 '2:目标位置来过了,好马不吃回头草!
 if  not isempty(Arr_Conn(Target_x,Target_y)) then  
  exit Sub '不再判断
 end if
 '3:前方是敌人!
 select case SGF_Step mod 2
  case 0'黑棋吃白棋,判断白旗死活
   if  QiP.rows(Target_x).cells(Target_y).className="B" then    
    Arr_Conn(Target_x,Target_y)=0'在黑棋出现的地方插一个旗
    exit Sub '不再判断
   end if
  case 1'白棋吃黑棋,判断黑旗死活
   if  QiP.rows(Target_x).cells(Target_y).className="W" then    
    Arr_Conn(Target_x,Target_y)=0'在白棋出现的地方插一个旗
    exit Sub '不再判断
   end if 
 end select
 '站在新地方,作为判断死活的起点
 '站在新地方,4个方向试探4次:上x,y-1;下x,y+1;左x-1,y右x+1,y    
 Sub_Conn Target_x ,Target_y,Target_x,Target_y-1 '上x,y-1; 
 Sub_Conn Target_x ,Target_y,Target_x,Target_y+1 '下x,y+1
 Sub_Conn Target_x ,Target_y,Target_x-1,Target_y '左x-1,y
 Sub_Conn Target_x ,Target_y,Target_x+1,Target_y '右x+1,y 
end sub

</SCRIPT>
13asiacup-2-2.sgf文件

(;
EV[]
GN[]
PW[Archimond]
WR[2d*]
PB[xxdnn]
BR[1d*]
RE[W+Resign]
DT[2004-07-24]
SZ[19]TM[300]KM[6.5]
HA[0]
;B[dd];W[pd];B[dq];W[pp];B[nq];W[qn];B[jp];W[cn];B[co];W[bo];B[cp];W[bp]
;B[bq];W[cr];B[cq];W[dn];B[eo];W[cj];B[en];W[fq];B[eq];W[jq];B[iq];W[kq]
;B[ir];W[kp];B[jo];W[mp];B[np];W[no];B[oo];W[op];B[mo];W[nn];B[lp];W[mq]
;B[lq];W[mr];B[ko];W[lr];B[lo];W[kr];B[qq];W[qp];B[rp];W[ro];B[pr];W[rr]
;B[nr];W[or];B[oq];W[pq];B[os];W[ms];B[ns];W[qs];B[qr];W[rs];B[ch];W[em]
;B[dl];W[dm];B[cl];W[bm];B[bl];W[el];B[dj];W[gn];B[go];W[ho];B[gp];W[hn]
;B[hp];W[di];B[ci];W[dk];B[ej];W[ek];B[ck];W[bj];B[bi];W[fj];B[ei];W[fi]
;B[eh];W[fh];B[gl];W[hl];B[gk];W[ik];B[hj];W[ij];B[hi];W[jh];B[ii];W[ji]
;B[hg];W[gg];B[ig];W[fk];B[fm];W[fn];B[ge];W[eg];B[dh];W[fe];B[gf];W[ff]
;B[fd];W[aq];B[ap];W[ao];B[br];W[al];B[aj];W[ee];B[df];W[ed];B[fc];W[ec]
;B[fb];W[de];B[dc];W[cf];B[dg];W[cd];B[cc];W[bd];B[eb];W[bb];B[bc];W[ac]
;B[ad];W[db];B[ab];W[cb];B[nd];W[nc];B[mc];W[oc];B[me];W[mb];B[lc];W[lb]
;B[kb];W[kc];B[jb];W[le];B[kd];W[pf];B[ng];W[qh];B[kk];W[kj];B[mk];W[ld]
;B[md];W[ke];B[jd];W[mf];B[nf];W[mi];B[ni];W[mh];B[nh];W[mj];B[nj];W[mg]
;B[kf];W[je];B[jg];W[kg];B[jf];W[lf];B[kh];W[lh];B[lg];W[id];B[jc];W[kg]
;B[jr];W[ps];B[lg];W[gd];B[kg];W[hf];B[he];W[ie];B[if];W[hd];B[hf];W[hb]
;B[hc];W[gc];B[gb];W[ic];B[ha];W[ia];B[ll];W[oe];B[lj];W[ki];B[lk];W[li]
;B[ne];W[om];B[qi];W[ph];B[pi];W[nk];B[nl];W[ok];B[ol];W[pk];B[pl];W[qk]
;B[ql];W[rj];B[ri];W[rh];B[sh];W[rl];B[rg];W[rf];B[qg];W[pg];B[qc];W[pc]
;B[qe];W[qf];B[qd];W[qb];B[rb];W[pb];B[la];W[nb];B[re];W[ra];B[rc];W[sf]
;B[pe];W[od];B[of];W[sd];B[se];W[sb]
;)

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值