有什么好玩的单机游戏
[角色扮演]
·樱花大战2
·监狱大亨2:最高防备 Prison Tycoon 2
·超魔法大战 Cross Hermit
·新倚天屠龙记
·神圣纪事 SACRED
·天下霸图
·赛伯利亚之谜 Syberia
·绝无冬之夜 Neverwinter Nights
·机战少女
· 007夜火 James Bond 007: Nightfire
·梦幻模拟战之千年纪 Langrisser Mille
·西游奇缘
·幻想三国志之石焚刃暖
·新剑侠情缘
·轩辕剑4
·足球经理2009 Football Manager 2009
·时空飞梭 TimeShift
·越战大兵(Vietcong)
·龙战士4 Breath Of Fire IV
·轩辕剑4外传苍之涛
[即时战略]
·三国演义3
·罗马帝国的荣耀 Glory Of The Roman E
·圣战群英传:神圣国度 Disciples:Sacr
·太阳帝国的原罪 Sins of a Solar Empi
·艾云卡斯之法师的崛起 Avencast Rise
·金帐汗国 The Golden Horde
·战争前线:转折点 War Front:Turning P
·席德梅尔的海盗 Sid Meier`s Pirates
·美丽新世界 Anno1503
·黑暗史诗 Fate
·命令与征服:变节者 Command& Conquer
·敌我之战 I of the Enemy
·郑问之三国志
·魔域争霸 Atrox
·太空帝国 4 Space Empires IV
·红色警戒 95 Red Aralm 95
·闪电战 Blitzkrieg
·罗马全面战争 Rome Total War
·士兵二战英雄 Soldiers:Heroes of Wo
·决战王朝2
[棋牌游戏]
·陪女打麻将中文版
·漫画麻将
·明星3缺1单机版
·旅行扑克
·美眉麻将
·弹珠跳棋(Chinese Checkers) V1.5汉化
·梭哈(Show hand)
·霍伊尔纸牌游戏2007(Hoyle Card Games
·夏威夷接龙(Aloha Tripeaks)
·围棋高手(Dariush)
·佩格棋(PegIt) V1.1.6
·木屋纸牌(Hardwood Solitaire)III
·命运塔罗牌(FATE:The Carnivale Game)
·极品麻将(Mah Jong Adventures)
·黄金纸牌十二合一(Golden Dozen Solit
·德克萨斯纸牌(Tik’s Texas Hold’em)
·夏威夷纸牌(Aloha Solitaire)
·探险纸牌(Tri-Peaks Solitaire to Go)
·梭哈大师(Five Card Deluxe)
·国际象棋大师(Chessmaster Challenge)
[动作射击]
·捍卫雄鹰4.0 Falcon4.0
·机甲闪击 Roboblitz
·我是一颗小水珠 I-Fluid
·雷曼:疯狂兔子2 Rayman Raving Rabbi
·战争的真相 Faces of War
·钢铁人 Iron Man
·绝命凄杀 Zero Critical
·龙与地下城:恶魔之石 Forgotten Real
·别惹蚂蚁 The Ant Bully
·终极蜘蛛侠 ULTIMATE SPIDERMAN
·炮灰向前冲
·铁血联盟2野火 Jagged Alliance2: Wil
·倩女幽魂之鬼寺 Ghost Temple
·燃烧飞车:末日浩劫 Hard Truck Apoca
·东方妖妖梦
·式神之城3 shikigami 3
·西魔复活 Bionic Commando Rearmed
·爵爷吉祥
·二战坦克指挥官 WWII Tank Commander
·王者之剑:黑暗之斧
最近更新 5- 8 [智力游戏]
·模拟狩猎2007 Bass Pro Shops Trophy
·现代航空大亨 Airline Tycoon Evoluti
·席德梅尔的铁路 Sid Meiers Railroads
·铁道王 Railroad Pioneer
·模拟主题乐园 SimCoaster
·第一次亲密接触 First
·埃及祖玛4之探索永恒 Luxor Quest For
·铁路大亨3 Railroad Tycoon 3
·海滨嘉年华 Beach Life
·美少女梦工厂1 2绮丽版 PrincessMaker
·职业钓鱼 Rapala Fishing
·探险道
·咕噜小天使 Gurumin
·创业王 C.E.O
·一掷千金:秘密金库游戏(Deal or No D
·疯狂水管(Pipe Mania)
·模拟人生2(The sims 2)
·幽灵庄园的秘密
·勇者泡泡龙4
·金刚战争
[方块游戏]
·希魔复活复刻版(Bionic Commando Rear
·奥德赛泡泡龙
·圣诞老人的麻烦(Santa Trouble)
·异时空打砖块2(Break Ball 2 Gold)
·趣味萤火虫(Glow Worm)
·梦幻七大陆(7 Lands)
·音乐教室(Sveerz Deluxe) V1.3
·银色圣诞(Xmas Bonus)
·鬼脸水珠(Beads)
·妖怪之箱(Monsterz)
·蛇神宝珠(ZombieBall)
·珍宝岛(Treasure Island)
·祖鲁宝石(Zulu Gems)
·耶利哥之墙(The Walls of Jericho)
·土著怪脸(Incadia)
·外婆之家(Flip or Flop)
·甜蜜糖果(Sweet Tooth To Go)
·蔬菜娃娃(Harvest Mania To Go)
·数字祖玛(Twistingo)
·七彩齿轮(Gearz)
[赛车游戏]
·科林麦克雷拉力2 Colin McRae Rally
·卡丁车公开赛 open kart
·极速挑战:维伦纽夫的赛车生涯 Speed
· UAZ职业4驱锦标赛 UAZ Racing 4x4
· 2008年世界摩托大奖赛MOD版 MotoGp 2
· 3D豪华遥控赛车 3D Ultra Radio Cont
· Jacket暴力摩托2006
·霹雳游侠2 Knight Rider 2
·爆发:极限自由滑雪 Freak Out Extre
·野蛮踏板车竞速赛 Scooter War3Z
·伊森赛车 1nsane
·极品飞车9:最高通缉 Need For Speed
·疯狂山地自行车 Mountain Bike Adren
·梦幻四驱车
·特技摩托2(Trials 2)
·完美机车(Pure)硬盘版
·线条滑雪2(Line Rider 2: Unbound)
·国际机车联盟格伦披治大赛3(FIM Spee
·疯狂小鸡卡丁车(Crazy Chicken Kart
·欧洲卡车模拟(Euro Truck Simulator)
[PC模拟]
·双截龙全集
·街头霸王降龙加强版
·魂斗罗全集
·侍魂 3(amurai Shodown 3)
·侍魂 4(samurai shodown 4)
·拳皇(The King of Fighters) 97
·拳皇2002(The King of Fighters) 2002
·侍魂 5(Samurai Shodown 5)
·拳皇2001(The King of Fighters) 2001
·月华剑士(The Last Blade)
·超钢战记(Tech Romancer)
·拳皇经典10周年se完美版
·雷电2005全新3D版
·经典街机
·百鬼夜宴
·格斗之王2003
·拳皇无限版
·侍魂全集(Samurai Shodown)
·拳皇(The King of Fighters) 2006
·街头霸王东东不死传说真人版试玩版
排行榜 [总榜]
·仙剑奇侠传四硬盘版
·狙击手:胜利的艺术(Sniper: Art of V
·魔兽争霸III冰封王座中文版1.20E完美
·真三国无双5(Shin Sangokumusou 5)
·劲乐团单机版
·命令与征服:红色警戒3(Red Alert 3)
·三国群英传7
·功夫熊猫(Kung Fu Panda)简体中文版
·明星3缺1单机版
·天龙八部简体中文完美版
[月榜]
·仙剑奇侠传四硬盘版
·劲乐团单机版
·三国群英传7
·捍卫雄鹰4.0 Falcon4.0
·实况足球8中文解说版
·魔兽争霸III冰封王座中文版1.20E完美
· 2008年世界摩托大奖赛MOD版 MotoGp 20
·炽天使:二战空骑兵 Blazing Angels:
·狙击手:胜利的艺术(Sniper: Art of V
·超魔法大战 Cross Hermit
[周榜]
·仙剑奇侠传四硬盘版
·劲乐团单机版
·三国演义3
·三国群英传7
·实况足球8中文解说版
·捍卫雄鹰4.0 Falcon4.0
·狙击手:胜利的艺术(Sniper: Art of V
·魔兽争霸III冰封王座中文版1.20E完美
·新倚天屠龙记
·极品飞车9:最高通缉 Need For Speed M
[今日最受欢迎]
·三国志8
·极品飞车9:最高通缉 Need For Speed M
·幻想三国志4
·仙剑奇侠传四硬盘版
·暗黑破坏神II毁灭之王V1.11(Diablo II
·功夫熊猫(Kung Fu Panda)简体中文版
·半条命II叛乱(Half-Life II Insurgenc
·潜行者:晴空(S.T.A.L.K.E.R.: Clear
·轩辕剑4外传苍之涛
·圣域魔都魅影 Sacred Underworld
下跳棋有什么技巧
跳棋技巧:开局在一局跳棋中占着相当重要的地位,就像是短跑里的起跑,落后就几乎没有机会了,所以在跳棋高手的对局中,如果开局犯下错误,就会被对方潮水般的进攻打的毫无还手之力,狼狈不堪。
当然像其他棋类一样,跳棋开局也有其固定的走法及相应的对策,不妨借用一下围棋中的术语“定式”来表示。
说到跳棋开局定式,就是跳棋开局中的基本走法,按此走法进行,双方均能较快的出动己方的子力,同时还根据对方的走法来牵制和反牵制,到双方子力开始初步接触,也就是定式进行完的时候,局面相当,保持均势发展。
扩展资料:跳棋的中盘战是千变万化的,机会稍纵即逝,所以在跳棋的中盘战中,即要准确的把握机会,也要会创造机会。跳棋的中盘虽然变化多端,无迹可寻。
在中盘的战斗中,要以跳为原则,要修好自己的“跳路”,尽量的使自己的跳路通畅,同时还要注意,不能让自己修的跳路给对方提供跳的便利。此称之为攻。
攻防是跳棋最关键的内容,攻和防不是独立的,只攻不防与只防不攻都不是取胜之道。只有把握好攻防之间的辩证关系,才能百战不殆。
求跳棋游戏VB代码
VB跳棋代码:
窗体代码:
Dim ChessBoard(-2 To 10,-2 To 10) As Byte''棋盘(8竖*8棋)
Dim x(10) As Integer, y(10) As Integer''搜索的每种走法
Dim x1(10) As Integer, y1(10) As Integer''搜索的每种走法的可吃子坐标
Dim BestLocate As CHESSER
Dim CurrentPlayer As Byte''当前玩家
Dim CurrentStep As Integer''当前步
Dim人机模式 As Boolean
Dim cSel As Byte''玩家选择了哪个棋子
Dim tTemp As Boolean
Const MAXDOWNPOINT= 7
Rem如果Cer为1(黑方),则返回2(红方),否则返加1(黑方)
Public Function NextCer(ByVal Cer As Byte) As Byte
NextCer= 1
If Cer= 1 Then NextCer= 2
End Function
Rem棋盘
Private Sub Initial()
Dim i As Integer, j As Integer
For i= 1 To 8: For j= 1 To 8: ChessBoard(i, j)= 0: Next j: Next i
ChessBoard(1, 2)= 201
ChessBoard(1, 4)= 201
ChessBoard(1, 6)= 201
ChessBoard(1, 8)= 201
ChessBoard(2, 1)= 201
ChessBoard(2, 3)= 201
ChessBoard(2, 5)= 201
ChessBoard(2, 7)= 201
ChessBoard(3, 2)= 201
ChessBoard(3, 4)= 201
ChessBoard(3, 6)= 201
ChessBoard(3, 8)= 201
ChessBoard(6, 1)= 101
ChessBoard(6, 3)= 101
ChessBoard(6, 5)= 101
ChessBoard(6, 7)= 101
ChessBoard(7, 2)= 101
ChessBoard(7, 4)= 101
ChessBoard(7, 6)= 101
ChessBoard(7, 8)= 101
ChessBoard(8, 1)= 101
ChessBoard(8, 3)= 101
ChessBoard(8, 5)= 101
ChessBoard(8, 7)= 101
End Sub
Rem反显示(将屏幕显示的内容存入ChessBoard数组)
Private Sub ReDisplay()
Dim i As Integer, j As Integer, k As Integer
k= 0
For i= 1 To 8
For j= 1 To 8
If cbText(k).Text="" Then ChessBoard(i, j)= 0
If cbText(k).Text="101" Then ChessBoard(i, j)= 101
If cbText(k).Text="201" Then ChessBoard(i, j)= 201
If cbText(k).Text="102" Then ChessBoard(i, j)= 102
If cbText(k).Text="202" Then ChessBoard(i, j)= 202
k= k+ 1
Next j
Next i
End Sub
Rem显示(将ChessBoard数组的内容显示到屏幕后)
Private Sub Display()
Dim i As Integer, j As Integer, k As Integer
k= 0
For i= 1 To 8
For j= 1 To 8
If ChessBoard(i, j)= 0 Then
cbText(k).Text=""
Else
cbText(k).Text= ChessBoard(i, j)
End If
k= k+ 1
Next j
Next i
Call胜负判断
End Sub
Rem胜负判断
Private Sub胜负判断()
Dim i As Integer, j As Integer
Dim a As Integer, b As Integer
a= 0: b= 0
For i= 1 To 8
For j= 1 To 8
If Int(ChessBoard(i, j)/ 100)= 1 Then a= a+ 1''计算玩家的棋子数
If Int(ChessBoard(i, j)/ 100)= 2 Then b= b+ 1''计算电脑的棋子数
Next j
Next i
If a= 0 Then Call MsgBox("我赢了!", vbOKOnly+ 32,"提示:"): Exit Sub
If b= 0 Then Call MsgBox("我认输了!", vbOKOnly+ 32,"提示:"): Exit Sub
End Sub
Rem返回估值
Private Function CurrentValue(Cer As Byte) As Integer
Dim i As Integer, j As Integer
CurrentValue= 0
For i= 1 To 8
For j= 1 To 8
If Int(ChessBoard(i, j)/ 100)= Cer Then _
CurrentValue= CurrentValue+ ChessBoard(i, j) Mod 100* 100+ 100''是我方的棋子,棋子为1加100分,棋子为2加200分
If Int(ChessBoard(i, j)/ 100)= NextCer(Cer) Then _
CurrentValue= CurrentValue-(ChessBoard(i, j) Mod 100* 100+ 100)''对方的棋子,棋子为1减100分,棋子为2减200分
Next j
Next i
End Function
Rem如果Cer方i,j的棋子还可以吃子则返回True
Private Function IsLine(Cer As Byte, i As Byte, j As Byte) As Boolean
Dim x As Byte, y As Byte, x1 As Byte, y1 As Byte
IsLine= False
''开始搜索棋盘
''如果是Cer方的棋子
If Int(ChessBoard(i, j)/ 100)= Cer Then
''吃子式走法1:即如果基本走法的位置有对方的棋子则可以跳吃(走法限制:Cer为1或棋子为加强棋才可走)
If Int(ChessBoard(i- 1, j- 1)/ 100)= NextCer(Cer) And(Cer= 1 Or ChessBoard(i, j) Mod 100= 2) Then
x=(i- 1)- 1''目标坐标
y=(j- 1)- 1
x1= i- 1''吃子坐标
y1= j- 1
If x> 0 And y> 0 And x< 9 And y< 9 And ChessBoard(x, y)= 0 Then IsLine= True'有可吃子,返回True
End If
''吃子式走法2
If Int(ChessBoard(i- 1, j+ 1)/ 100)= NextCer(Cer) And(Cer= 1 Or ChessBoard(i, j) Mod 100= 2) Then
x=(i- 1)- 1
y=(j+ 1)+ 1
x1= i- 1
y1= j+ 1
If x> 0 And y> 0 And x< 9 And y< 9 And ChessBoard(x, y)= 0 Then IsLine= True'有可吃子,返回True
End If
''吃子式走法3
If Int(ChessBoard(i+ 1, j- 1)/ 100)= NextCer(Cer) And(Cer= 2 Or ChessBoard(i, j) Mod 100= 2) Then
x=(i+ 1)+ 1
y=(j- 1)- 1
x1= i+ 1
y1= j- 1
If x> 0 And y> 0 And x< 9 And y< 9 And ChessBoard(x, y)= 0 Then IsLine= True'有可吃子,返回True
End If
''吃子式走法4
If Int(ChessBoard(i+ 1, j+ 1)/ 100)= NextCer(Cer) And(Cer= 2 Or ChessBoard(i, j) Mod 100= 2) Then
x=(i+ 1)+ 1
y=(j+ 1)+ 1
x1= i+ 1
y1= j+ 1
If x> 0 And y> 0 And x< 9 And y< 9 And ChessBoard(x, y)= 0 Then IsLine= True'有可吃子,返回True
End If
End If
End Function
Rem如果Cer方的棋子还可以吃子则返回True
Private Function IsLine2(Cer As Byte) As Boolean
Dim x As Byte, y As Byte, x1 As Byte, y1 As Byte
Dim i As Integer, j As Integer
IsLine2= False
''开始搜索棋盘
For i= 1 To 8
For j= 1 To 8
''如果是Cer方的棋子
If Int(ChessBoard(i, j)/ 100)= Cer Then
''吃子式走法1:即如果基本走法的位置有对方的棋子则可以跳吃(走法限制:Cer为1或棋子为加强棋才可走)
If Int(ChessBoard(i- 1, j- 1)/ 100)= NextCer(Cer) And(Cer= 1 Or ChessBoard(i, j) Mod 100= 2) Then
x=(i- 1)- 1''目标坐标
y=(j- 1)- 1
x1= i- 1''吃子坐标
y1= j- 1
If x> 0 And y> 0 And x< 9 And y< 9 And ChessBoard(x, y)= 0 Then IsLine2= True'有可吃子,返回True
End If
''吃子式走法2
If Int(ChessBoard(i- 1, j+ 1)/ 100)= NextCer(Cer) And(Cer= 1 Or ChessBoard(i, j) Mod 100= 2) Then
x=(i- 1)- 1
y=(j+ 1)+ 1
x1= i- 1
y1= j+ 1
If x> 0 And y> 0 And x< 9 And y< 9 And ChessBoard(x, y)= 0 Then IsLine2= True'有可吃子,返回True
End If
''吃子式走法3
If Int(ChessBoard(i+ 1, j- 1)/ 100)= NextCer(Cer) And(Cer= 2 Or ChessBoard(i, j) Mod 100= 2) Then
x=(i+ 1)+ 1
y=(j- 1)- 1
x1= i+ 1
y1= j- 1
If x> 0 And y> 0 And x< 9 And y< 9 And ChessBoard(x, y)= 0 Then IsLine2= True'有可吃子,返回True
End If
''吃子式走法4
If Int(ChessBoard(i+ 1, j+ 1)/ 100)= NextCer(Cer) And(Cer= 2 Or ChessBoard(i, j) Mod 100= 2) Then
x=(i+ 1)+ 1
y=(j+ 1)+ 1
x1= i+ 1
y1= j+ 1
If x> 0 And y> 0 And x< 9 And y< 9 And ChessBoard(x, y)= 0 Then IsLine2= True'有可吃子,返回True
End If
End If
Next j
Next i
End Function
Rem搜索程序
Private Function Search(Cer As Byte, Steps As Integer, IsTop As Boolean, UpMax As Integer)
Dim a As Integer, b As Integer, b1 As Integer, b2 As Integer, i As Integer, j As Integer, k As Integer, l As Integer, v As Integer
Dim MaxValue As Integer
Dim Sc(40) As CHESSER
Dim IsEat(7) As Boolean''搜索到的7种走法有没有吃子
Dim EAT As Boolean''有没有吃子
If IsTop Then
List1.Clear
For i= 0 To 40: Sc(i).Allow= False: Next i';默认情况下所有走法皆不允许,如果所有值均为False则皆允许
End If
EAT= False
For i= 0 To 7: IsEat(7)= False: Next i''默认情况所有搜索到的走法都没有吃子
Steps= Steps- 1
If Steps< 1 And IsLine2(Cer)= False Then
''如果我方无子可吃时才返回估值
Search=-CurrentValue(Cer)''返回估值
Exit Function
End If
k= 0
''开始搜索棋盘
For i= 1 To 8
For j= 1 To 8
''如果是Cer方的棋子
If Int(ChessBoard(i, j)/ 100)= Cer Then
For i1= 1 To MAXDOWNPOINT: x(i1)= 0: x1(i1)= 0: Next''x记载所有走法,清空x
''列出所有走法
''基本走法:上左、上右、下左、下右
x(0)= i- 1: y(0)= j- 1
x(1)= i- 1: y(1)= j+ 1
x(2)= i+ 1: y(2)= j- 1
x(3)= i+ 1: y(3)= j+ 1
''棋子表示方法:白棋 101(普通)、102(过底的威力棋)
''红棋 201(普通)、202(过底的威力棋)
''下一句解释:如果是白棋(101、102),不允许后退(删除x(2)、x(3))
If Cer= 1 And ChessBoard(i, j) Mod 100<> 2 Then x(2)=-2: x(3)=-2
''下一句解释:如果是红棋(201、202),不允许后退(删除x(0)、x(1))
If Cer= 2 And ChessBoard(i, j) Mod 100<> 2 Then x(0)=-2: x(1)=-2
''吃子式走法1:即如果基本走法的位置有对方的棋子则可以跳吃(走法限制:Cer为1或棋子为加强棋才可走)
If Int(ChessBoard(i- 1, j- 1)/ 100)= NextCer(Cer) And(Cer= 1 Or ChessBoard(i, j) Mod 100= 2) Then
x(4)=(i- 1)- 1''目标坐标
y(4)=(j- 1)- 1
x1(4)= i- 1''吃子坐标
y1(4)= j- 1
If x(4)> 0 And y(4)> 0 And x(4)< 9 And y(4)< 9 And ChessBoard(x(4), y(4))= 0 Then _
EAT= True: IsEat(4)= True''有可吃子,必需走此步,其余走法无效
End If
''吃子式走法2
If Int(ChessBoard(i- 1, j+ 1)/ 100)= NextCer(Cer) And(Cer= 1 Or ChessBoard(i, j) Mod 100= 2) Then
x(5)=(i- 1)- 1
y(5)=(j+ 1)+ 1
x1(5)= i- 1
y1(5)= j+ 1
If x(5)> 0 And y(5)> 0 And x(5)< 9 And y(5)< 9 And ChessBoard(x(5), y(5))= 0 Then _
EAT= True: IsEat(5)= True''有可吃子,必需走此步,其余走法无效
End If
''吃子式走法3
If Int(ChessBoard(i+ 1, j- 1)/ 100)= NextCer(Cer) And(Cer= 2 Or ChessBoard(i, j) Mod 100= 2) Then
x(6)=(i+ 1)+ 1
y(6)=(j- 1)- 1
x1(6)= i+ 1
y1(6)= j- 1
If x(6)> 0 And y(6)> 0 And x(6)< 9 And y(6)< 9 And ChessBoard(x(6), y(6))= 0 Then _
EAT= True: IsEat(6)= True''有可吃子,必需走此步,其余走法无效
End If
''吃子式走法4
If Int(ChessBoard(i+ 1, j+ 1)/ 100)= NextCer(Cer) And(Cer= 2 Or ChessBoard(i, j) Mod 100= 2) Then
x(7)=(i+ 1)+ 1
y(7)=(j+ 1)+ 1
x1(7)= i+ 1
y1(7)= j+ 1
If x(7)> 0 And y(7)> 0 And x(7)< 9 And y(7)< 9 And ChessBoard(x(7), y(7))= 0 Then _
EAT= True: IsEat(7)= True''有可吃子,必需走此步,其余走法无效
End If
''如果有吃子走法,删除没有吃子的其它走法
If EAT= True Then
For a= 0 To 7
If IsEat(a)= False Then x(a)=-1
Next a
End If
''存入Sc(走法表)中
For a= 0 To 7
'If x(a)= 5 And y(a)= 2 Then Stop
''如果超过棋盘将不能走
If x(a)> 0 And y(a)> 0 And x(a)< 9 And y(a)< 9 Then
''如果目标有棋子则不能走,为0才存入
If ChessBoard(x(a), y(a))= 0 Then
''将走法存入“走法表”
Sc(k).Initx= i
Sc(k).Inity= j
Sc(k).ObjX= x(a)
Sc(k).ObjY= y(a)
Sc(k).x1= x1(a)''被吃子位置
Sc(k).y1= y1(a)
If IsEat(a)= True Then Sc(k).Allow= True''如果有吃子,则允许此着走法
k= k+ 1
End If
End If
Next a
'If EAT= True Then i= 100: j= 100''如果有吃子则不必再搜索
End If
Next j
Next i
MaxValue=-30000''当前分数
tTemp= False
''搜索是否有允许走法,如果没有则所有走法皆允许
For i= 0 To k- 1
If Sc(i).Allow= True Then tTemp= True
Next i
''如果有允许走法,则除允许走法外,其余走法皆不允许走
If tTemp= False Then
For i= 0 To k- 1: Sc(i).Allow= True: Next i
End If
''试走每种走法
For i= 0 To k- 1
If Sc(i).Allow= True Then
b1= ChessBoard(Sc(i).Initx, Sc(i).Inity)''记录起点棋子和终点棋子
b2= ChessBoard(Sc(i).ObjX, Sc(i).ObjY)
b= ChessBoard(Sc(i).x1, Sc(i).y1)''记录被吃子位置的棋子
ChessBoard(Sc(i).Initx, Sc(i).Inity)= 0''清除起点的棋子
ChessBoard(Sc(i).ObjX, Sc(i).ObjY)= b1''试下棋
ChessBoard(Sc(i).x1, Sc(i).y1)= 0''清除被吃子位置的棋子
''如果到边界则威力加强
''下句:如果是黑方(101、102)
If Cer= 1 Then
''下句:如果走到第一行则棋子变成102,威力加强
If Sc(i).ObjX= 1 Then ChessBoard(Sc(i).ObjX, Sc(i).ObjY)= 102
End If
''下句:如果是红方(201、202)
If Cer= 2 Then
''下句:如果走到第八行则棋子变成202,威力加强
If Sc(i).ObjX= 8 Then ChessBoard(Sc(i).ObjX, Sc(i).ObjY)= 202
End If
If b> 0 And IsLine(Cer, Sc(i).ObjX, Sc(i).ObjY)= True And EAT= True Then
''如果可连续吃子
v= CurrentValue(Cer)+ 300''V为当前局面价值加300分
Else
v= Search(NextCer(Cer), Steps- 1, False,-UpMax)''没有连续可吃子,继续搜索
End If
''恢复棋盘
ChessBoard(Sc(i).x1, Sc(i).y1)= b''恢复被吃子
ChessBoard(Sc(i).Initx, Sc(i).Inity)= b1''记录起点棋子和终点棋子
ChessBoard(Sc(i).ObjX, Sc(i).ObjY)= b2
''显示每种走法的得分
If IsTop Then
List1.AddItem"从"& Str(Sc(i).Initx)&","& Str(Sc(i).Inity)& _
"到"& Str(Sc(i).ObjX)&","& Str(Sc(i).ObjY)&"得分:"& Str(v)
End If
'如果这种走法分数高,记录
If IsTop And(v> MaxValue Or MaxValue=-30000) Then
BestLocate.Initx= Sc(i).Initx
BestLocate.Inity= Sc(i).Inity
BestLocate.ObjX= Sc(i).ObjX
BestLocate.ObjY= Sc(i).ObjY
BestLocate.x1= Sc(i).x1
BestLocate.y1= Sc(i).y1
MaxValue= v
End If
If v> MaxValue Then MaxValue= v
'下句:如果 MaxValue>=-UpMax//α-β剪枝,符合剪枝条件的就Cut掉。UpMax为上层的MaxValue
If IsTop= False And MaxValue>=-UpMax Then i= 100''剪枝程序
End If
Next i
If IsTop= False Then Search=-MaxValue Else Search= MaxValue
End Function
Private Sub cbText_Click(Index As Integer)
Dim i As Integer, j As Integer, C As Integer''C记载吃子
Dim Temp As String, Temp2 As String, Temp3 As String
Dim x As Byte, y As Byte, x2 As Byte, y2 As Byte
If cbText(Index).BackColor<>&HC0E0FF Then Call MsgBox("落棋无效!", vbOKOnly+ 32,"提示:"): Exit Sub
If cSel= 0 And Trim(cbText(Index).Text)>"" Then cSel= Index: cbText(cSel).ForeColor= QBColor(12): Exit Sub''如果玩家一个也没先且当前棋盘位置有棋子,则标示玩家选择此棋子
If cSel<> 0 And Val(cbText(Index).Text)= Val(cbText(cSel).Text) Then cbText(cSel).ForeColor= H80000008&: cSel= 0: Exit Sub''如果玩家两次选择相同的棋子则取消选择
If cSel<> 0 Then
''下棋
cbText(Index).Text= cbText(cSel).Text
''判断是否可变成加强棋
k= Val(cbText(Index).Text)
If Int(k/ 100)= 1 And Index< 8 Then cbText(Index).Text="102"''如果1方走到顶端就变成加强棋
If Int(k/ 100)= 2 And Index> 55 Then cbText(Index).Text="202"''如果2方走到顶端就变成加强棋
cbText(cSel).Text=""
cbText(cSel).ForeColor= H80000008&
''判断有没有吃子
''向上左斜
If Index- cSel=-18 Then
cbText(Index+ 9).Text="":''被吃子
C= Index+ 9
End If
''向上右斜
If Index- cSel=-14 Then
cbText(Index+ 7).Text="":''被吃子
C= Index+ 7
End If
''向下左斜
If Index- cSel= 14 Then
cbText(Index- 7).Text="":''被吃子
C= Index- 7
End If
''向下右斜
If Index- cSel= 18 Then
cbText(Index- 9).Text="":''被吃子
C= Index- 9
End If
''存储走法
k= 0: Temp="": Temp2="": Temp=""
For i= 1 To 8
For j= 1 To 8
If k= cSel Then Temp="从"& Str(i)+","+ Str(j)
If k= Index Then Temp2="到"+ Str(i)+","+ Str(j): x= i: y= j
If k= C Then Temp3="吃子"& Str(i)&","& Str(j): x2= i: y2= j
k= k+ 1
Next j
Next i
List2.AddItem"第"& Str(CurrentStep)&"手"& Str(CurrentPlayer)+"方"+ Temp+ Temp2+ Temp3
CurrentStep= CurrentStep+ 1
Text3.Text= Temp+ Temp2
cSel= 0
Call ReDisplay
''下句:如果是人机模式并且玩家还没有可吃子
If人机模式= True And(IsLine(CurrentPlayer, x, y)= True And x2> 1 And y2> 2)= False Then
'If人机模式= True Then
''看玩家走了哪方的棋子,就运算另一方的棋子
CurrentPlayer= NextCer(Int(Val(cbText(Index).Text)/ 100))
Call Command2_Click''如果是人机模式则让电脑运长
End If
End If
End Sub
Private Sub Command1_Click()
List2.Clear''清除棋谱
CurrentStep= 1
Call Initial
Call Display
End Sub
Private Sub Command2_Click()
Dim t As Boolean
Command2.Enabled= False
t:
Text1.Text= Str(Search(CurrentPlayer, Val(Text2.Text), True, 0))
Command2.Enabled= True
With BestLocate
t= DownChess(.Initx,.Inity,.ObjX,.ObjY,.x1,.y1)
Call Display
If t= True And IsLine(CurrentPlayer,.ObjX,.ObjY) Then Call MsgBox("我还想再吃一个"): GoTo t''如果所下之棋还能吃子(连续吃)则再运算
End With
CurrentPlayer= NextCer(CurrentPlayer)
End Sub
Rem移棋
Rem Sx,Sy:起点棋子 Ex,Ey:终点棋子 Ax,Ay:被吃子
Rem如果有吃子则返回True
Private Function DownChess(Sx As Byte, Sy As Byte, ex As Byte, ey As Byte, Ax As Byte, Ay As Byte) As Boolean
ChessBoard(ex, ey)= ChessBoard(Sx, Sy)
ChessBoard(Sx, Sy)= 0
ChessBoard(Ax, Ay)= 0''清除被吃子
If Ax<> 0 And Ay<> 0 Then DownChess= True Else DownChess= False
Text3.Text="第"& Str(CurrentStep)&"手"& Str(CurrentPlayer)+"方从"& Str(Sx)+","+ Str(Sy)+"到"+ Str(ex)+","+ Str(ey)& _
"吃子"& Str(Ax)&","& Str(Ay)
CurrentStep= CurrentStep+ 1
List2.AddItem Text3.Text
''下句:如果是黑方(101、102)
If Int(ChessBoard(ex, ey)/ 100)= 1 Then
''下句:如果走到第一行则棋子变成102,威力加强
If ex= 1 Then ChessBoard(ex, ey)= 102
End If
''下句:如果是红方(201、202)
If Int(ChessBoard(ex, ey)/ 100)= 2 Then
''下句:如果走到第八行则棋子变成202,威力加强
If ex= 8 Then ChessBoard(ex, ey)= 202
End If
End Function
Rem运算一
Private Sub Command3_Click()
CurrentPlayer= 1
Call Command2_Click
End Sub
Rem运算二
Private Sub Command4_Click()
CurrentPlayer= 2
Call Command2_Click
End Sub
Private Sub Command5_Click()
Call ReDisplay
End Sub
Private Sub Command6_Click()
If人机模式= False Then人机模式= True Else人机模式= False
If人机模式= False Then Command6.Caption="人机模式": Command6.ToolTipText="当前模式:人人对战" Else Command6.Caption="休息模式": Command6.ToolTipText="当前模式:人机对战"
End Sub
Private Sub Command7_Click()
End
End Sub
Rem存谱
Private Sub Command8_Click()
On Error GoTo e
Dim i As Integer
Open InputBox("请输入文件名:") For Output As#1
For i= 0 To List2.ListCount- 1
Print#1, List2.List(i)
Next i
Close#1
Exit Sub
e:
Call MsgBox("存储错误!", vbOKOnly+ 32,"提示:")
Err.Clear
Exit Sub
End Sub
Private Sub Form_Load()
人机模式= False
cSel= 0
CurrentPlayer= 1
Call Command1_Click
End Sub
模块代码:
Type CHESSER
Chess As Byte''为何棋,在BestLocate则标明为何数组
Initx As Byte''起初棋的位置
Inity As Byte
ObjX As Byte''经运算后的落棋点
ObjY As Byte
x1 As Byte
y1 As Byte
Allow As Boolean''是否允许
End Type