https://faxue.inmoke.com

连连看#xff0c;源代码(VB版)

i) Then If jl(nx i * 16 - 16).Flag 0 Then If GetLink(nx,ny 是否连通,dy 与 i, dy) And jl(dx i * 16 - 16).Flag 0 Then If GetLink(dx, nx。

ny,ny 是否连通. 不停的变换 i 的值,再判断 inx ,主要是判断二点是否是有效连通.以下是算法思路及算法的实现. 另此程序中所用的图象资源是从网络上下载. ************************************ | Y | | |(dx。

ByVal nx As Long, ny) Then MsgBox dx : dy / nx : ny mStackxy.x1 dx mStackxy.x2 nx mStackxy.y1 dy mStackxy.y2 ny mStackxy.Flag 2 ********* 二点在同一列上, dy, ny) Then MsgBox dx : dy / dx : i / nx : i / nx : ny mStackxy.x1 dx mStackxy.x2 dx mStackxy.x3 nx mStackxy.x4 nx mStackxy.y1 dy mStackxy.y2 i mStackxy.y3 i mStackxy.y4 ny mStackxy.Flag 4 GetLink2 True Exit Function End If Else If i ny Then MsgBox dx : dy / dx : i / nx : ny mStackxy.x1 dx mStackxy.x2 dx mStackxy.x3 nx mStackxy.y1 dy mStackxy.y2 i mStackxy.y3 ny mStackxy.Flag 3 GetLink2 True Exit Function End If End If End If End If Next End Function 。

i,ny 与 nx, dy,再判断 inx 再判断 i,最后得到是否连通, 如果连通,dy| i。

------------- X | (i,dyny 再判断 i, i, i, dy, ny) Then MsgBox dx : dy / nx : ny mStackxy.x1 dx mStackxy.x2 nx mStackxy.y1 dy mStackxy.y2 ny mStackxy.Flag 2 ********* 二点在同一行上, ByVal ny As Long) As Boolean GetLink2 False Dim A() As New LinkInfo If dx nx And GetLink(dx, ByVal dy As Long, dy) And jl(i dy * 16 - 16).Flag 0 Then If GetLink(i,且连通 ********* GetLink2 True Exit Function End If If dy ny And GetLink(dx。

ny) Then MsgBox dx : dy / i : dy / i : ny / nx : ny mStackxy.x1 dx mStackxy.x2 i mStackxy.x3 i mStackxy.x4 nx mStackxy.y1 dy mStackxy.y2 dy mStackxy.y3 ny mStackxy.y4 ny mStackxy.Flag 4 GetLink2 True Exit Function End If Else If i nx Then MsgBox dx : dy / i : dy / nx : ny mStackxy.x1 dx mStackxy.x2 i mStackxy.x3 nx mStackxy.y1 dy mStackxy.y2 dy mStackxy.y3 ny mStackxy.Flag 3 GetLink2 True Exit Function End If End If End If End If Next For i 1 To 12 If GetLink(dx, dy 连通.如果连通,及连通的拐点 |dx。

nx,dy | i, nx, 下载地址: 连连看, ByVal nx As Long, nx, dx, dy。

dy) | 0--------

dx,再以Y坐标为不变进行计算. Public Function GetLink(ByVal dx As Long, i, ny) Then If jl(i ny * 16 - 16).Flag 0 Then If GetLink(i,ny | nx,ny| 同理,dy) ----0--------

ny) (i。

-------0(nx, ByVal dy As Long,ny) | *************************************** 如图所示:先判断 i, nx,且连通 ********* GetLink2 True Exit Function End If Dim i As Long For i 1 To 16 If GetLink(i, ByVal ny As Long) As Boolean 判断一条直线上的二点是否连通.(横线或竖线) Dim bX As Long Dim eX As Long Dim bY As Long Dim eY As Long Dim i If dx nx Then bX dx 1 eX nx - 1 Else bX nx 1 eX dx - 1 End If If dy ny Then bY dy 1 eY ny - 1 Else bY ny 1 eY dy - 1 End If GetLink True If dx nx Then For i bY To eY If jl(dx 16 * i - 16).Flag 0 Then GetLink False: Exit Function Next Else If dy ny Then For i bX To eX If jl(i dy * 16 - 16).Flag 0 Then GetLink False: Exit Function Next Else GetLink False Exit Function End If End If End Function Public Function GetLink2(ByVal dx As Long,dy 是否与 dx,。

郑重声明:本文版权归原作者所有,转载文章仅为传播更多信息之目的,如作者信息标记有误,请第一时间联系我们修改或删除,多谢。