欢迎来到【jd hydra 源码】【未来影视主题源码】【淘宝资源吧源码】lineCount源码-皮皮网网站!!!

皮皮网

【jd hydra 源码】【未来影视主题源码】【淘宝资源吧源码】lineCount源码-皮皮网 扫描左侧二维码访问本站手机端

【jd hydra 源码】【未来影视主题源码】【淘宝资源吧源码】lineCount源码

2024-11-27 03:09:51 来源:{typename type="name"/} 分类:{typename type="name"/}

1.通达信捕捉牛股利器 条件选股公式
2.vb问题 求各位帮忙

lineCount源码

通达信捕捉牛股利器 条件选股公式

       通达信选股公式:

       条件选股公式源码:

       年认同价:=MA(C,);

       价格中枢:=(SUM(年认同价,0)/(BARSSINCE(年认同价>0)+));

       箱顶:=价格中枢*1.2;

       箱底:=价格中枢*0.8;

       毛利润率:=FINANCE()/FINANCE();

       成长价值:=年认同价*(1+毛利润率);

       收益价值:=年认同价+FINANCE();

       回调认同:=EMA(EXPMA(C,),);

       多头:=(回调认同>REF(回调认同,1))AND(成长价值>REF(成长价值,1))AND(收益价值>REF(收益价值,1))AND(DYNAINFO(7)>0);

       回调条件:=COUNT(C<回调认同,5)>=3;

       回调突破:=(REF(C,1)<=REF(回调认同,1))AND(C>回调认同)AND(回调条件)AND多头;

       成长条件:=COUNT(C<成长价值,5)>=3;

       成长突破:=(REF(C,1)<=REF(成长价值,1))AND(C>成长价值)AND(成长条件)AND多头;

       收益条件:=COUNT(C<收益价值,5)>=3;

       收益突破:=(REF(C,1)<=REF(收益价值,1))AND(C>收益价值)AND(收益条件)AND多头;

       箱底条件:=COUNT(C<箱底,5)>=3;

       箱底突破:=(REF(C,1)<=REF(箱底,1))AND(C>箱底)AND(箱底条件)AND多头;

       价格条件:=COUNT(C<价格中枢,5)>=3;

       价格突破:=(REF(C,1)<=REF(价格中枢,1))AND(C>价格中枢)AND(价格条件)AND多头;

       箱顶条件:=COUNT(C<箱顶,5)>=3;

       箱顶突破:=(REF(C,1)<=REF(箱顶,1))AND(C>箱顶)AND(箱顶条件)AND多头;

       突破买点:(回调突破+成长突破+收益突破+箱底突破+价格突破+箱顶突破);

       专买老鼠仓

       { 老鼠仓}

       AA1:=AMOUNT/V;

       BB1:=L<AA1*0.9;

       CC1:=(C-REF(C,1))/REF(C,1)*>1.2;

       DD1:=L<MA(C,5)*0.;

       EE1:=V<MA(V,5)*1.5;

       FF1:=BB1 AND CC1 AND DD1 AND EE1;

       DRAWTEXT(FF1,(LOW* 0.),'老鼠仓'),COLORFF;

       老鼠仓是个很不错的指标,信号发出一般都在一个波段的底部起涨之时。

       根据本人的jd hydra 源码实践,使用指标时候要注意几点:

       1 该指标可以添加到任何一个主图里面去,比如MA均线什么的未来影视主题源码

       2 出现信号当天买进股票,淘宝资源吧源码第二天收阳继续持股,直到出阴为止。

       3 第二天出阴考虑卖出,非常适合短线操作!

       老鼠仓(选股公式)

       AA1:=AMOUNT/V;

       BB1:=L<AA1*0.9;

       CC1:=(C-REF(C,1))/REF(C,1)*>1.2;

       DD1:=L<MA(C,5)*0.;

       EE1:=V<MA(V,5)*1.5;

       老鼠仓:BB1AND CC1 AND DD1 AND EE1;

       理想选股(选股公式)

       VAR1:=MA((LOW+HIGH+CLOSE)/3,5);

       VAR2:=CLOSE=HHV(C,4) AND REF(C,1)=LLV(C,4);

       VAR3:=REF(C,1)=LLV(C,4) AND C>=REF(C,2) OR REF(C,2)=LLV(C,4) ANDREF(C,1)<=REF(C,3) AND REF(C,2)<REF(C,4) AND C>=REF(C,1);

       VAR4:=VAR1>REF(VAR1,1) AND REF(VAR1,1)<REF(VAR1,2);

       VAR5:=LOW<HHV(VAR1,) AND HIGH>HHV(VAR1,) AND CLOSE>REF(C,1) ANDCLOSE>OPEN;

       VAR6:=VAR5 AND COUNT(VAR4,2);

       VAR7:=VAR6 AND NOT(REF(VAR6,1));

       VAR8:=*EMA(EMA(C-REF(C,1),6),6)/EMA(EMA(ABS(C-REF(C,1)),6),6);

       VAR9:=EMA(MA(C,),);

       VAR:=FILTER((LLV(VAR8,2)=LLV(VAR8,7) AND COUNT(VAR8<0,2) ANDCROSS(VAR8,MA(VAR8,2)))=1,5);

       VAR:=SMA(EMA((C-REF(C,1))/REF(C,1),5)*,3,1)*;

       VAR:=FILTER(((CROSS(VAR,0) OR CROSS(C,VAR9)) AND VAR)=1,3);

       VAR:=MA(C,)>=REF(MA(C,),3) AND CROSS(C,MA(C,));

       RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*;

       K:=SMA(RSV,3,1);

       D:=SMA(K,3,1);

       J:=3*K-2*D;

       金叉:=CROSS(J,D);

       死叉:=CROSS(D,J);

       买1:=(VAROR VAR) AND VAR;

       买2:=(VAROR VAR) AND VAR3;

       买3:=(VAROR VAR) AND VAR2;

       买4:=(VAR2AND VAR) OR (VAR3 AND VAR);

       买5:=(金叉AND VAR3) OR (金叉 AND VAR2) OR (金叉 AND VAR);

       ST:=EXIST(C/REF(C,1)>1.,);

       输出:=(买1OR 买2OR 买3OR 买4OR 买5OR VAR7) AND ST;

       MA5:=MA(C,5),COLORWHITE;

       X:=(3*C+L+O+H)/6;

       多空线:=(*X+*REF(X,1)+*REF(X,2)+*REF(X,3)+*REF(X,4)+*REF(X,5)+*REF(X,6)

       +*REF(X,7)+*REF(X,8)+*REF(X,9)+*REF(X,)+9*REF(X,)+8*REF(X,)

       +7*REF(X,)+6*REF(X,)+5*REF(X,)+4*REF(X,)+3*REF(X,)+2*REF(X,)+

       REF(X,))/,COLORFFFF,LINETHICK1;

       AB:=DRAWLINE(HIGH>=HHV(HIGH,),HIGH,LOW<=LLV(LOW,3),HHV(HIGH,3),1),COLORYELLOW;

       CROSS(MA5,多空线) and CROSS(C,AB) and 输出 ;

       点石成金(选股公式)

       KS:=(CLOSE-MA(CLOSE,))/MA(CLOSE,)*(-);

       RSV:=(CLOSE-LLV(LOW,))/(HHV(HIGH,)-LLV(LOW,))*;

       FASTK:=SMA(RSV,3,1);K:=SMA(FASTK,3,1);D:=SMA(K,5,1);

       Var1:=CLOSE/MA(CLOSE,)*<;

       Var2:=CLOSE/MA(CLOSE,)*<;

       Var3:=HIGH>LOW*1.;

       Var4:=Var3 AND COUNT(Var3,5)>1;

       Var4 AND (Var1 OR Var2) AND REF(KS,1)>= AND REF(KS,1)/KS>=1.AND

       CLOSE/REF(CLOSE,1)>=1.;

       牛市绝底(选股公式)

       VAR1:=REF(CLOSE,1);

       VAR2:=((SMA(MAX((CLOSE - VAR1),0),7,1) / SMA(ABS((CLOSE - VAR1)),7,1)) * );

       VAR3:=((SMA(MAX((CLOSE - VAR1),0),,1) / SMA(ABS((CLOSE - VAR1)),,1)) *);

       VAR4:=(( * (HHV(HIGH,) - LOW)) / HHV(HIGH,));

       VAR5:=(( * (HIGH - LLV(LOW,))) / LLV(LOW,));

       牛市绝底:VAR2< AND VAR3 < AND (VAR2 + VAR3) > AND VAR4 > ANDBARSCOUNT(CLOSE) > ;

       飞弹一号(选股公式)

       var1:=c/ma(c,)*<;

       var2:=c/ma(c,)*<;

       var3:=h>=l*1.;

       var4:=var3 and count(var3,5)>=2;

       xg:var4 and (var1 or var2) and count(h=l and c=o and c<ref(c,1),3)=0

       and hhv(v/capital,)<0.8;

       跟庄建仓源码

       A:=DYNAINFO(7);

       A:=BARSCOUNT(CLOSE);

       A:=(SMA((CLOSE / HHV(HIGH,)),3,1) * );

       A:=IF((A > ),A,0);

       A:=IF((LOW > A),0,IF((HIGH < A),1,(((A - LOW) + 0.) / ((HIGH -LOW) + 0.))));

       A:=DMA(A,(VOL / CAPITAL)) * ;

       A:=IF((((A > 0) AND (A > REF(A,1))) AND (A <= )),A,0);

       Var1:=3*SMA((CLOSE-LLV(LOW,))/(HHV(HIGH,)-LLV(LOW,))*,5,1)-2*SMA(SMA((CLOSE-LLV(LOW,))/(HHV(HIGH,)-LLV(LOW,))*,5,1),3,1);

       Var2:=EMA(Var1,8);

       Var3:=3*SMA((C-LLV(L,))/(HHV(H,)-LLV(L,))*,5,1)-2*SMA(SMA((C-LLV(L,))/(HHV(H,)-LLV(L,))*,5,1),3,1);

       趋势:=EMA(Var3,3)-;

       STICKLINE(趋势>,趋势,,5,0);

       DRAWICON(CROSS(趋势,0),0,1);

       STICKLINE((A > 0 AND (趋势< OR 趋势>REF(趋势,1)AND趋势<)),0,A,6,0),colorFFff;

       机构建仓区:0,LINETHICK0,colorFFFF;

       Var4:=(趋势-REF(趋势,1))/REF(趋势,1)*;

       STICKLINE(趋势<=,0,,3,0),colorcc;

       DRAWTEXT(FILTER(趋势<=,),,'准备现金'),colorcc;

       STICKLINE(趋势<= AND Var4>,0,,2,0),colorff;

       Var5:=FILTER((趋势<= AND Var4>),);

       DRAWTEXT(Var5,,'买入'),colorff;

       STICKLINE(趋势>= AND Var4,0,,3,0),colorgray;

       Var6:=FILTER((趋势>= AND Var4),);

       DRAWTEXT(Var6,,'清仓'),colorgray;

       Var7:=LLV(LOW,);

       Var8:=HHV(HIGH,);

       Var9:=EMA((CLOSE-Var7)/(Var8-Var7)*4,4)*;

       STICKLINE(Var9>,,,3,2),COLORRED;

       Var:=(Var9-LLV(Var9,4))/(HHV(Var9,4)-LLV(Var9,4))*;

       DRAWTEXT(IF(CROSS(Var9,Var) AND Var9>,,0),,'险'),ColorFF;

       DRAWICON(CROSS(,Var9),,9);

       Var:=SMA(ABS(L-REF(L,1)),3,1)/SMA(MAX(L-REF(L,1),0),3,1)*;

       Var:=HHV(Var,)*8;

       火焰山:EMA(IF(LOW<=Var7AND 趋势<,(Var+Var),0),3)/,COLORRED,linethick2;

       STICKLINE(火焰山>0,0 ,火焰山*1.2,4,0 ),COLORRED;

       Var:=(MA(C,1)+MA(C,3)+MA(C,5)+MA(C,7)+MA(C,9))/5;

       Var:=(MA(C,2)+MA(C,4)+MA(C,6)+MA(C,8)+MA(C,))/5;

       趋势线:趋势,colorff;

       Var:=MAX(EMA(Var,2)-EMA(Var,5),0)*;

       Var:=EMA(Var,5);

       波浪峰:Var,stick,colorffff;

       STICKLINE(Var<REF(Var,1),0,Var,1,0),colorff;

       Var:=MA(趋势线,8);

       if(CROSS(Var2,Var) AND Var2<,,0),COLORRED;

       DRAWTEXT(CROSS(趋势线,Var2)AND 趋势线>REF(趋势线,1)AND 趋势线<,,'追涨'),COLORffff;

       风险区:IF(趋势>,趋势,),colorffff;

       双信号"全仓"选股(选股公式)

       FF:=EMA(CLOSE,3);

       MA:=EMA(CLOSE,);

       TTJ:=CROSS(FF,MA);

       上:=EMA(C,3),COLORBLUE,LINETHICK1;

       中:=EMA(C,5),COLORWHITE,LINETHICK1;

       下:=EMA(中,5),COLORFF,LINETHICK1;

       QQ:= C<中;

       MM:=上>REF(上,1)AND REF(上,1)<REF(上,2) ;

       V1:=ABS((2*CLOSE+HIGH+LOW)/4-MA(CLOSE,))/MA(CLOSE,);

       V2:=(1-7/)*(DMA(CLOSE,V1));

       V3:=(1+7/)*(DMA(CLOSE,V1));

       V5:=MA((LOW+HIGH+CLOSE)/3,5);

       MA1:=MEMA(CLOSE,5);

       MA2:=ATAN((MA1/REF(MA1,1)-1)*)*/3.;

       MA3:=IF(MA2>0,MA2,MA2);

       MA5:=MA(CLOSE,5),COLOR;

       MA:=MA(CLOSE,),COLORFFF0,LINETHICK2;

       VAR:=CLOSE=HHV(C,4) AND (REF(C,1)>=REF(C,2) OR REF(C,1)>=REF(C,3))

       OR REF(C,1)=HHV(C,4) AND CLOSE>=REF(C,2) OR REF(C,2)=HHV(C,4) AND

       REF(C,3)=LLV(C,4) AND C>=REF(C,1) OR REF(C,3)=HHV(C,4) AND

       C>=REF(C,1) AND C>=REF(C,2);

       { 收盘价=4日内收盘价的最高值AND 昨收>=2日前的收盘价}

       VAR:=CLOSE=HHV(C,4) AND REF(C,1)=LLV(C,4);

       { 收盘价=4日内收盘价的最高值AND 昨收=4日内收盘价的最低值}

       VAR:=CLOSE=LLV(C,4) AND (REF(C,1)<REF(C,2) OR REF(C,1)<REF(C,3)) OR

       REF(C,1)=LLV(C,4) AND C<REF(C,2) OR REF(C,2)=LLV(C,4) AND

       REF(C,1)=HHV(C,4) AND C<REF(C,1) OR REF(C,3)=LLV(C,4) AND

       C<REF(C,1) AND C<REF(C,2);

       { 收盘价=4日内收盘价的最低值AND (昨收<2日前的收盘价}

       VAR:=REF(C,1)=LLV(C,4) AND C>=REF(C,2) OR REF(C,2)=LLV(C,4) AND

       REF(C,1)<=REF(C,3) AND REF(C,2)<REF(C,4) AND C>=REF(C,1);

       { 昨收=4日内收盘价的最低值AND 收盘价>=2日前的收盘价}

       VAR:=REF(C,1)=HHV(C,4) AND C<REF(C,2) OR (REF(C,2)=HHV(C,4) AND

       REF(C,1)>REF(C,3) OR REF(C,3)=HHV(C,4) AND REF(C,1)>REF(C,2)) AND

       REF(C,2)>=REF(C,4) AND C<REF(C,1);

       { 昨收=4日内收盘价的最高值AND 收盘价<2日前的收盘价}

       VAR:=V5>REF(V5,1) AND REF(V5,1)<REF(V5,2);

       { 今日V5向上形成拐点}

       VAR:=LOW<HHV(V5,) AND HIGH>HHV(V5,) AND CLOSE>REF(C,1) ANDCLOSE>OPEN;

       VAR:=VAR AND COUNT(VAR,2);

       VAR:=*EMA(EMA(C-REF(C,1),6),6)/EMA(EMA(ABS(C-REF(C,1)),6),6);

       VAR:=EMA(MA(C,),);

       VAR:=FILTER((LLV(VAR,2)=LLV(VAR,7) AND COUNT(VAR<0,2) AND

       CROSS(VAR,MA(VAR,2)))=1,5);

       VAR:=FILTER((HHV(VAR,2)=HHV(VAR,7) AND COUNT(VAR>,2) AND

       CROSS(MA(VAR,2),VAR))=1,1);

       VAR:=SMA(EMA((C-REF(C,1))/REF(C,1),5)*,3,1)*;

       VAR:=FILTER(((CROSS(VAR,0) OR CROSS(C,VAR)) AND VAR)=1,3);

       VAR:=MA(C,)>=REF(MA(C,),3) AND CROSS(C,MA(C,));

       VAR:=VAR AND NOT(REF(VAR,1));

       RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*;

       K:=SMA(RSV,3,1);

       D:=SMA(K,3,1);

       J:=3*K-2*D;

       金叉:=CROSS(J,D);

       死叉:=CROSS(D,J);

       买1:=(VAROR VAR) AND VAR;

       买2:=(VAROR VAR) AND VAR;

       买3:=(VAROR VAR) AND VAR;

       买4:=(VARAND VAR) OR (VAR AND VAR);

       买5:=(金叉AND VAR) OR (金叉 AND VAR) OR (金叉 AND VAR);

       TTJ0:=VAR;

       TTJ1:=买1OR 买2OR 买3OR 买4OR 买5AND MM;

       XG0:=TTJ AND TTJ0;

       XG1:=TTJ AND TTJ1;

       XG:=XG0 OR XG1;

       { 以下波浪理论浪底重叠"买底"选股原码}

       PL5:=ZIG(3,5);

       EN1:=ZIG(3,5)>REF(ZIG(3,5),1) AND REF(ZIG(3,5),1)<=REF(ZIG(3,5),2) ANDREF(ZIG(3,5),2)<=REF(ZIG(3,5),3);

       EX1:=ZIG(3,5)<REF(ZIG(3,5),1) AND REF(ZIG(3,5),1)>=REF(ZIG(3,5),2) ANDREF(ZIG(3,5),2)>=REF(ZIG(3,5),3);

       PL:=ZIG(3,);

       EN2:=ZIG(3,)>REF(ZIG(3,),1) AND REF(ZIG(3,),1)<=REF(ZIG(3,),2)AND REF(ZIG(3,),2)<=REF(ZIG(3,),3);

       EX2:=ZIG(3,)<REF(ZIG(3,),1) AND REF(ZIG(3,),1)>=REF(ZIG(3,),2)AND REF(ZIG(3,),2)>=REF(ZIG(3,),3);

       PL:=ZIG(3,);

       EN3:=ZIG(3,)>REF(ZIG(3,),1) AND REF(ZIG(3,),1)<=REF(ZIG(3,),2)AND REF(ZIG(3,),2)<=REF(ZIG(3,),3);

       EX3:=ZIG(3,)<REF(ZIG(3,),1) AND REF(ZIG(3,),1)>=REF(ZIG(3,),2)AND REF(ZIG(3,),2)>=REF(ZIG(3,),3);

       PL:=ZIG(3,);

       走强1:=BARSLAST(PL5<REF(PL5,1));

       走弱1:=BARSLAST(PL5>REF(PL5,1));

       走强2:=BARSLAST(PL<REF(PL,1));

       走弱2:=BARSLAST(PL>REF(PL,1));

       走强3:=BARSLAST(PL<REF(PL,1));

       走弱3:=BARSLAST(PL>REF(PL,1));

       ZTJZ5:=IF(PL>REF(PL,1),COUNT(EN1,走强2),0);

       ZTJD5:=IF(PL>REF(PL,1),COUNT(EX1,走强2),0);

       DTJZ5:=IF(PL<REF(PL,1),COUNT(EN1,走弱2),0);

       DTJD5:=IF(PL<REF(PL,1),COUNT(EX1,走弱2),0);

       ZTJZ:=IF(PL>REF(PL,1),COUNT(EN2,走强3),0);

       ZTJD:=IF(PL>REF(PL,1),COUNT(EX2,走强3),0);

       DTJZ:=IF(PL<REF(PL,1),COUNT(EN2,走弱3),0);

       DTJD:=IF(PL<REF(PL,1),COUNT(EX2,走弱3),0);

       TJ:=EN2 AND ZTJZ5=1;

       TJ:=EN1 AND PL>REF(PL,1) AND ZTJZ5=2;

       TJ:=EN2 AND DTJZ=1;

       TJ:=EN3 AND ZTJZ=1;

       TJ:=EN2 AND PL>REF(PL,1) AND ZTJZ=2;

       XG:=TJ OR TJ OR TJ OR TJ OR TJ;

       { 以下二者结合共同选股}

       XG:=XG OR XG;

       W:EXIST(XG,1);

vb问题 求各位帮忙

       网上转载的,呵呵,我也不太明白

       '在窗体上加入以下控件

       'image1(0),多头指标公式源码image1(0) - 黑白棋

       'image2,image3(0)

       'form中的picture为棋盘。因无法上传,请自行领会。黑客教程网源码

       Option Explicit

       Dim I, J, K, Counter, Firstmoved, Rt, Gen, r, flag As Integer

       Dim Grid(), H(), V(), RL(), LR(), Tb(2), Order() As Integer

       Private Sub Form_Initialize()

       lblHelp.Top = 0

       lblHelp.Left = 0

       Image1(0).Top = -

       Image1(1).Top = -

       lblHelp.Left = -lblHelp.Width

       lblHelp = vbCrLf + vbCrLf + " 游戏帮助" + vbCrLf _

       + vbCrLf + vbCrLf + "●游戏规则:黑方先行,轮流弈子,任一方向先连成五子者胜." _

       + vbCrLf + vbCrLf + vbCrLf + "●操作提示:①可选择[先后]、[难度]和[对手]菜单设置游戏," _

       + vbCrLf + vbCrLf + " 只有按[游戏]->[开始]后才可在棋盘上落子." _

       + vbCrLf + vbCrLf + " ②按[游戏]->[清盘]可重玩并设置游戏." _

       + vbCrLf + vbCrLf + " ③落子后按[动作]菜单下的选择可任意悔棋和恢复." _

       + vbCrLf + vbCrLf + " ④各功能菜单都提供了快捷键(Alt+相应字母)." _

       + vbCrLf + vbCrLf + vbCrLf + "●有什么问题请与本人联系.电子邮件:xwwxyz@sina.com." _

       + vbCrLf + vbCrLf + vbCrLf + "●本页面单击后隐藏."

       End Sub

       Private Sub Form_Resize()

       Me.Height =

       Me.Width =

       End Sub

       Private Sub lblHelp_Click()

       lblHelp.Visible = False

       End Sub

       Private Sub mnuAfter_Click()

       Firstmoved = 0

       mnuAfter.Checked = True

       mnuFirst.Checked = False

       End Sub

       Private Sub Form_Load()

       Dim I As Integer

       For I = 1 To

       Load Image3(I) '加载棋子控件

       Image3(I).Top = (I \ ) * + 5

       Image3(I).Left = (I Mod ) * + 5

       Image3(I).Visible = True

       Next

       Ini

       End Sub

       '游戏初始化

       Sub Ini()

       For I = 0 To

       Image3(I) = Image2

       Image3(I).Enabled = False

       Grid(I) = 0

       V(I) = 0

       H(I) = 0

       LR(I) = 0

       RL(I) = 0

       Next I

       mnuBack.Enabled = False

       Counter = 0

       Gen = 0

       If mnuAfter.Checked = True Then

       Firstmoved = 0

       Else

       Firstmoved = 1

       End If

       mnuStart.Enabled = True

       End Sub

       '一方是否可获胜

       Function LineWin(Piece As Integer) As Integer

       Dim mun As Integer

       LineWin =

       '五子一线

       mun = Piece * 5

       For I = 0 To

       If H(I) = mun Or V(I) = mun Or RL(I) = mun Or LR(I) = mun Then

       LineWin = + Piece

       Exit Function

       End If

       Next I

       '四子一线

       mun = Piece * 4

       For I = 0 To

       If H(I) = mun Then

       For K = 0 To 4

       If Grid(I + K) = 0 Then LineWin = I + K: Exit Function

       Next K

       End If

       If V(I) = mun Then

       For K = 0 To 4

       If Grid(I + K * ) = 0 Then LineWin = I + K * : Exit Function

       Next K

       End If

       If RL(I) = mun Then

       For K = 0 To 4

       If Grid(I + K * ) = 0 Then LineWin = I + K * : Exit Function

       Next K

       End If

       If LR(I) = mun Then

       For K = 0 To 4

       If Grid(I + K * ) = 0 Then LineWin = I + K * : Exit Function

       Next K

       End If

       Next I

       End Function

       '计算机走棋

       Sub ComputerMove()

       Dim ToMove As Integer

       If Counter = 0 Then

       Randomize

       I = Int(Rnd * 7 + 4)

       J = Int(Rnd * 7 + 4)

       If Grid(I * + J) = 0 Then ToMove = I * + J

       Else

       If mnuLower.Checked = True Then ToMove = Defend Else ToMove = Attempt

       End If

       Counter = Counter + 1

       If Firstmoved = 0 Then Image3(ToMove) = Image1(0) Else Image3(ToMove) = Image1(1)

       Grid(ToMove) = 2

       Order(Counter) = ToMove

       LineGen ToMove, 6

       If LineWin(6) = Then

       MsgBox "您输了!"

       Ini

       Exit Sub

       End If

       If Counter = Then

       MsgBox "和棋"

       Ini

       Exit Sub

       End If

       End Sub

       '低级模式

       Function Defend() As Integer

       Rt = LineWin(6)

       If Rt < Then Defend = Rt: Exit Function

       Rt = LineWin(1)

       If Rt < Then Defend = Rt: Exit Function

       '查找落子位置

       Rt = FindBlank

       If Rt < Then Defend = Rt: Exit Function

       End Function

       '悔棋

       Private Sub mnuBack_Click()

       mnuComeback.Enabled = True

       If (Counter + Firstmoved) Mod 2 = 0 Then Rt = -1 Else Rt = -6

       Grid(Order(Counter)) = 0

       Image3(Order(Counter)) = Image2

       LineGen Order(Counter), Rt

       Counter = Counter - 1

       If mnuComputer.Checked = True Then

       Grid(Order(Counter)) = 0

       Image3(Order(Counter)) = Image2

       LineGen Order(Counter), -1

       Counter = Counter - 1

       Else

       flag = 1 - flag

       End If

       r = r + 1

       If Counter = 1 And Firstmoved = 0 And mnuComputer.Checked = True Then mnuBack.Enabled = False

       If Counter = 0 Then mnuBack.Enabled = False

       End Sub

       '恢复棋子

       Private Sub mnuComeback_Click()

       mnuBack.Enabled = True

       Counter = Counter + 1

       If (Counter + Firstmoved) Mod 2 = 0 Then

       Grid(Order(Counter)) = 1

       Image3(Order(Counter)) = Image1(1 - Firstmoved)

       LineGen Order(Counter), 1

       Else

       Grid(Order(Counter)) = 2

       Image3(Order(Counter)) = Image1(Firstmoved)

       LineGen Order(Counter), 6

       End If

       If mnuComputer.Checked = True Then

       Counter = Counter + 1

       Grid(Order(Counter)) = 2

       Image3(Order(Counter)) = Image1(Firstmoved)

       LineGen Order(Counter), 6

       Else

       flag = 1 - flag

       End If

       r = r - 1

       If r = 0 Then mnuComeback.Enabled = False

       End Sub

       Private Sub mnuComputer_Click() '对手

       mnuComputer.Checked = True '电脑

       mnuHuman.Checked = False '棋手

       End Sub

       Private Sub mnuClear_Click() '清盘

       Ini

       mnuFirst.Enabled = True

       mnuAfter.Enabled = True

       mnuLower.Enabled = True

       mnuHigher.Enabled = True

       mnuComputer.Enabled = True

       mnuHuman.Enabled = True

       End Sub

       Private Sub mnuHuman_Click()

       mnuHuman.Checked = True

       mnuComputer.Checked = False

       End Sub

       Private Sub mnuStart_Click() '开始

       lblHelp.Visible = False

       For I = 0 To

       Image3(I).Enabled = True

       Next I

       mnuFirst.Enabled = False

       mnuAfter.Enabled = False

       mnuLower.Enabled = False

       mnuHigher.Enabled = False

       mnuComputer.Enabled = False

       mnuHuman.Enabled = False

       If Firstmoved = 0 And mnuComputer.Checked = True Then ComputerMove

       If Firstmoved = 0 And mnuHuman.Checked = True Then flag = 1 Else flag = 0

       mnuStart.Enabled = False

       End Sub

       '玩家走棋

       Private Sub image3_Click(Index As Integer)

       If Grid(Index) <> 0 Then Exit Sub

       Counter = Counter + 1

       If Firstmoved = 0 Then

       Image3(Index) = Image1(1 - flag)

       Else

       Image3(Index) = Image1(flag)

       End If

       Grid(Index) = 1 + flag

       Order(Counter) = Index

       mnuBack.Enabled = True

       mnuComeback.Enabled = False

       r = 0

       LineGen Index, (1 + flag * 5)

       If LineWin(1 + flag * 5) = + flag * 5 Then

       If flag = 0 Then MsgBox "您赢了!" Else MsgBox "您输了!"

       Ini

       Exit Sub

       End If

       If Counter = Then

       MsgBox "和棋"

       Ini

       Exit Sub

       End If

       If mnuComputer.Checked = True Then ComputerMove Else flag = 1 - flag

       End Sub

       '查找可以落子的空位

       Function FindBlank() As Integer

       Dim wz, fs, lz, RndNum As Integer

       fs = -

       For wz = 0 To

       If Grid(wz) = 0 Then

       Grid(wz) = 2

       LineGen wz, 6

       Rt = Gen

       If Rt > fs Then fs = Rt: lz = wz

       Grid(wz) = 0

       LineGen wz, -6

       End If

       Next wz

       FindBlank = lz

       End Function

       '高级模式

       Function Attempt() As Integer

       Dim wz As Integer

       Rt = LineWin(6)

       If Rt < Then Attempt = Rt: Exit Function

       Rt = LineWin(1)

       If Rt < Then Attempt = Rt: Exit Function

       '查找落子位置

       Rt = linethree(6)

       If Rt < Then Attempt = Rt: Exit Function

       Rt = linethree(1)

       If Rt < Then

       Grid(Tb(0)) = 2

       LineGen Tb(0), 6

       Rt = Gen: wz = Tb(0)

       Grid(Tb(0)) = 0

       LineGen Tb(0), -6

       Grid(Tb(1)) = 2

       LineGen Tb(1), 6

       If Rt < Gen Then Rt = Gen: wz = Tb(1)

       Grid(Tb(1)) = 0

       LineGen Tb(1), -6

       Grid(Tb(2)) = 2

       LineGen Tb(2), 6

       If Rt < Gen Then Rt = Gen: wz = Tb(2)

       Grid(Tb(2)) = 0

       LineGen Tb(2), -6

       Attempt = wz

       Exit Function

       End If

       Rt = FindBlank

       If Rt < Then Attempt = Rt: Exit Function

       End Function

       Private Sub mnuFirst_Click() '先后手

       Firstmoved = 1

       mnuAfter.Checked = False

       mnuFirst.Checked = True

       End Sub

       Private Sub mnuHigher_Click()

       mnuLower.Checked = False

       mnuHigher.Checked = True

       End Sub

       Private Sub mnuLower_Click() '难度

       mnuLower.Checked = True

       mnuHigher.Checked = False

       End Sub

       '局势评估

       Function LineGen(ij, Piece)

       Dim b, e, mun As Integer

       I = ij \

       J = ij Mod

       '横线影响

       b = IIf(J - 4 > 0, J - 4, 0)

       e = IIf(J > , , J)

       For K = b To e

       mun = H(I * + K)

       If mun < 6 Then Gen = Gen + mun * 2 ^ mun

       If mun > 5 And mun Mod 6 = 0 Then mun = mun \ 6 - 1: Gen = Gen - mun * 2 ^ mun

       H(I * + K) = H(I * + K) + Piece

       mun = H(I * + K)

       If mun < 6 Then Gen = Gen - mun * 2 ^ mun

       If mun > 5 And mun Mod 6 = 0 Then mun = mun \ 6 - 1: Gen = Gen + mun * 2 ^ mun

       Next K

       '竖线影响

       b = IIf(I - 4 > 0, I - 4, 0)

       e = IIf(I > , , I)

       For K = b To e

       mun = V(K * + J)

       If mun < 6 Then Gen = Gen + mun * 2 ^ mun

       If mun > 5 And mun Mod 6 = 0 Then mun = mun \ 6 - 1: Gen = Gen - mun * 2 ^ mun

       V(K * + J) = V(K * + J) + Piece

       mun = V(K * + J)

       If mun < 6 Then Gen = Gen - mun * 2 ^ mun

       If mun > 5 And mun Mod 6 = 0 Then mun = mun \ 6 - 1: Gen = Gen + mun * 2 ^ mun

       Next K

       '撇线影响

       b = IIf(I - 4 > 0, I - 4, 0)

       e = IIf(I > , , I)

       b = IIf(b > J + I - IIf(J + 4 > , , J + 4), b, J + I - IIf(J + 4 > , , J + 4))

       e = IIf(e > J + I - IIf(J > 4, J, 4), J + I - IIf(J > 4, J, 4), e)

       For K = b To e

       mun = RL(K * + I + J - K)

       If mun < 6 Then Gen = Gen + mun * 2 ^ mun

       If mun > 5 And mun Mod 6 = 0 Then mun = mun \ 6 - 1: Gen = Gen - mun * 2 ^ mun

       RL(K * + I + J - K) = RL(K * + I + J - K) + Piece

       mun = RL(K * + I + J - K)

       If mun < 6 Then Gen = Gen - mun * 2 ^ mun

       If mun > 5 And mun Mod 6 = 0 Then mun = mun \ 6 - 1: Gen = Gen + mun * 2 ^ mun

       Next K

       '捺线影响

       b = IIf(I - 4 > 0, I - 4, 0)

       e = IIf(I > , , I)

       b = IIf(b > I - J + IIf(J - 4 > 0, J - 4, 0), b, I - J + IIf(J - 4 > 0, J - 4, 0))

       e = IIf(e > I - J + IIf(J > , , J), I - J + IIf(J > , , J), e)

       For K = b To e

       mun = LR(K * - I + J + K)

       If mun < 6 Then Gen = Gen + mun * 2 ^ mun

       If mun > 5 And mun Mod 6 = 0 Then mun = mun \ 6 - 1: Gen = Gen - mun * 2 ^ mun

       LR(K * - I + J + K) = LR(K * - I + J + K) + Piece

       mun = LR(K * - I + J + K)

       If mun < 6 Then Gen = Gen - mun * 2 ^ mun

       If mun > 5 And mun Mod 6 = 0 Then mun = mun \ 6 - 1: Gen = Gen + mun * 2 ^ mun

       Next K

       End Function

       '是否存在三子一线(可发展成五子联线)

       Function linethree(Piece As Integer) As Integer

       Dim mun As Integer

       linethree =

       '三子一线

       mun = Piece * 3

       For I = 0 To

       If H(I) = mun Then

       If Grid(I) = 0 Then

       If I Mod < Then

       If Grid(I + 5) = 0 Then

       For K = 1 To 4

       If Grid(I + K) = 0 Then

       Tb(0) = I + K

       Tb(1) = I

       Tb(2) = I + 5

       linethree = Tb(0)

       Exit Function

       End If

       Next K

       End If

       End If

       End If

       End If

       If V(I) = mun Then

       If Grid(I) = 0 Then

       If (I \ ) < Then

       If Grid(I + ) = 0 Then

       For K = 1 To 4

       If Grid(I + K * ) = 0 Then

       Tb(0) = I + K *

       Tb(1) = I

       Tb(2) = I +

       linethree = Tb(0)

       Exit Function

       End If

       Next K

       End If

       End If

       End If

       End If

       If RL(I) = mun Then

       If Grid(I) = 0 Then

       If (I \ ) < And I Mod > 4 Then

       If Grid(I + ) = 0 Then

       For K = 1 To 4

       If Grid(I + K * ) = 0 Then

       Tb(0) = I + K *

       Tb(1) = I

       Tb(2) = I +

       linethree = Tb(0)

       Exit Function

       End If

       Next K

       End If

       End If

       End If

       End If

       If LR(I) = mun Then

       If Grid(I) = 0 Then

       If (I \ ) < And I Mod < Then

       If Grid(I + ) = 0 Then

       For K = 1 To 4

       If Grid(I + K * ) = 0 Then

       Tb(0) = I + K *

       Tb(1) = I

       Tb(2) = I +

       linethree = Tb(0)

       Exit Function

       End If

       Next K

       End If

       End If

       End If

       End If

       Next I

       End Function

       Private Sub munHelp_Click() '帮助

       lblHelp.Visible = True

       End Sub