连连看游戏:将两个相同格子连接起来就会消失,看谁连的快,限时10分钟! |
用时: | 秒 |
height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | ||
height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | ||
height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | ||
height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | ||
height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | ||
height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | ||
height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | ||
height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | ||
height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | height=40> | ||
'初始化数字数组开始
for x=0 to 10
for y=0 to 17
numArray(x,y)=0
QuanArray(x,y)=0
next
next
'初始化数字数组结束
for x=1 to 9
for y=1 to 16
window.execScript "td_" & X & "_" & y & ".innerText =" & chr(34) & "0" & chr(34),"vbs"
next
next
'随便放些数字开始
do
randomize
RndX=cint(rnd*9)+1
randomize
Rndy=cint(rnd*16)+1
randomize
Myrnd=cint(rnd*30)+1
window.execScript "lastNum=td_" & RndX & "_" & Rndy & ".innerText","vbs"
if lastNum="0" then
window.execScript "td_" & RndX & "_" & Rndy & ".innerText =" & Myrnd,"vbs"
NumArray(RndX,Rndy)=Myrnd
totalNum=totalNum+1
do
randomize
RndX=cint(rnd*9)+1
randomize
Rndy=cint(rnd*16)+1
window.execScript "lastNum=td_" & RndX & "_" & Rndy & ".innerText"
if lastNum="0" then
window.execScript "td_" & RndX & "_" & Rndy & ".innerText =" & Myrnd,"vbs"
NumArray(RndX,Rndy)=Myrnd
totalNum=totalNum+1
exit do
end if
loop
end if
if totalNum=16*9 then exit do'如果生成了全部数字,那么退出
loop
'随便放些数字结束
sub aaa(obj)
for x=0 to 10
for y=0 to 17
QuanArray(x,y)=0
next
next
if obj1=obj.id then exit sub '如果选择还是相同那么认为没选,跳出本过程
Flag1=Flag1+1
Flag1=Flag1 mod 3
RTN=fase
select case Flag1
case 0'什么也没选
case 1
obj1=obj.id
Num1=obj.innerText
obj.bordercolor="#ff0000"
temarray=split(obj1,"_")
x1=cint(temarray(1))
y1=cint(temarray(2))
case 2
obj2=obj.id
Num2=obj.innerText
obj.bordercolor="#ff0000"
temarray=split(obj2,"_")
x2=cint(temarray(1))
y2=cint(temarray(2))
if Num1=Num2 then
RTN1=CheckLink(x1,y1,x2,y2)
if RTN1=true then
Dispear x1,y1,x2,y2
Flag1=0
else
'恢复
Flag1=0
window.execScript "td_" & x1 & "_" & y1 & ".bordercolor =" & chr(34) & "#00FF66" & chr(34),"vbs"
window.execScript "td_" & x2 & "_" & y2 & ".bordercolor =" & chr(34) & "#00FF66" & chr(34),"vbs"
end if
else
'恢复
Flag1=0
window.execScript "td_" & x1 & "_" & y1 & ".bordercolor =" & chr(34) & "#00FF66" & chr(34),"vbs"
window.execScript "td_" & x2 & "_" & y2 & ".bordercolor =" & chr(34) & "#00FF66" & chr(34),"vbs"
end if
end select
end sub
function CheckLink(xx1,yy1,xx2,yy2)
RTN=false
for x=0 to 10
for y=0 to 17
QuanArray(x,y)=0
next
next
QuanArray(xx1,yy1)=1
RTN2=gogogogo(xx1,yy1)
CheckLink= RTN
end function
function gogogogo(xx,yy)
'vartype(xx) & "!"& xx & "-" & yy & "*" & vartype(x2) & " !" & x2 & "-" & y2
'msgbox xx & "-" & yy
'if xx<=10 and xx>=0 and yy<=17 and yy>=0 then
'window.execScript "td_" & xx & "_" & yy & ".innertext =" & chr(34) & "#" & chr(34),"vbs"
'window.execScript "td_" & xx & "_" & yy & ".bordercolor =" & chr(34) & "#0000ff" & chr(34),"vbs"
'end if
if vartype(xx)<>2 then xx=cint(xx)
if vartype(yy)<>2 then yy=cint(yy)
if vartype(x2)<>2 then x2=cint(x2)
if vartype(y2)<>2 then y2=cint(y2)
if RTN=true then
gogogogo=true
exit function
end if
if (xx+1=x2 and yy =y2) or (xx-1=x2 and yy=y2) or (yy+1=y2 and xx=x2) or (yy-1=y2 and xx=x2) then'先判断四周是不是
'连到了的选项
gogogogo=true
RTN=true
exit function
else'这里是已经判断了四周不是
'向下开始
if xx+1<=10 then'是否碰壁
if not(xx+1=x2 and yy =y2) then'是否连到了
if numArray(xx+1,yy)=0 then '是否碰到了别的图片
'这里是空地,如果空地的其余三面连接目标图片,那么就结束了,ok!
if (xx+2 =x2 and yy=y2) or (xx+1 =x2 and yy+1=y2) or (xx+1 =x2 and yy-1=y2) then
'连到了的选项
gogogogo=true
RTN=true
exit function
else
'这里是空地但是还没连上目标mm
if QuanArray(xx+1,yy)=0 then'是否已经来过此地
'连通空地,继续走继续朝前走的选项
QuanArray(xx+1,yy)=1'撒尿标记:老孙从这个方向到此一游!
RTN2=gogogogo(xx+1,yy)'继续去取经
else
'来过了
end if
end if
else
'碰到了别的图片,和碰壁查不多
end if
else
'连到了的选项
gogogogo=true
RTN=true
exit function
end if
else
'碰壁了
end if
'向下结束
'向上开始
if xx-1>=0 then'是否碰壁
if not(xx-1=x2 and yy=y2) then '是否连到了
if numArray(xx-1,yy)=0 then '是否碰到了别的图片
'这里是空地,如果空地的其余三面连接目标图片,那么就结束了,ok!
if (xx-2 =x2 and yy=y2) or (xx-1 =x2 and yy+1=y2) or (xx-1 =x2 and yy-1=y2) then
'连到了的选项
gogogogo=true
RTN=true
exit function
else
'这里是空地但是还没连上目标mm
if QuanArray(xx-1,yy)=0 then'是否已经来过此地
'连通空地,继续走继续朝前走的选项
QuanArray(xx-1,yy)=2'撒尿标记:老孙从这个方向到此一游!
RTN2=gogogogo(xx-1,yy)'继续去取经
else
'来过了
end if
end if
else
'碰到了别的图片,和碰壁查不多
end if
else
'连到了的选项
gogogogo=true
RTN=true
exit function
end if
else
'碰壁了
end if
'向上结束
'向左开始
if yy-1>=0 then'是否碰壁
if not(yy-1=y2 and xx=x2) then '是否连到了
if numArray(xx,yy-1)=0 then '是否碰到了别的图片
'这里是空地,如果空地的其余三面连接目标图片,那么就结束了,ok!