ExcelHome技术论坛

 找回密码
 免费注册

QQ登录

只需一步,快速开始

快捷登录

搜索
EH技术汇-专业的职场技能充电站 妙哉!函数段子手趣味讲函数 Excel服务器-会Excel,做管理系统 效率神器,一键搞定繁琐工作
HR薪酬管理数字化实战 Excel 2021函数公式学习大典 Excel数据透视表实战秘技 打造核心竞争力的职场宝典
让更多数据处理,一键完成 数据工作者的案头书 免费直播课集锦 ExcelHome出品 - VBA代码宝免费下载
用ChatGPT与VBA一键搞定Excel WPS表格从入门到精通 Excel VBA经典代码实践指南
查看: 10719|回复: 34

[原创]我也凑个热闹--发个五子棋游戏

[复制链接]

TA的精华主题

TA的得分主题

发表于 2003-6-12 12:06 | 显示全部楼层 |阅读模式
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件       ★免费下载 ★       ★ 使用帮助
本帖已被收录到知识树中,索引项:娱乐和游戏应用
家里已经有很多的五子棋游戏了,我再来凑个热闹。望各高手指点,不胜感谢。 z0htkH5r.rar (29.68 KB, 下载次数: 731)

TA的精华主题

TA的得分主题

发表于 2003-6-17 21:27 | 显示全部楼层
一人一个鼠标, 玩起来还真像那么回事!

TA的精华主题

TA的得分主题

发表于 2003-6-18 22:43 | 显示全部楼层
太崇拜你了!太厉害了!原来EXCEL还可以这样,太神奇了!看来我要学习的东西太多了,今天好不容易才注册成功,以后我会经常来的,请多多指教!!!

TA的精华主题

TA的得分主题

发表于 2003-7-6 12:32 | 显示全部楼层
高!!!!!!!!!!! EXCELHOME的高手太多了 在这里我学到很多,我更爱EXCEL了!

TA的精华主题

TA的得分主题

发表于 2003-7-19 00:43 | 显示全部楼层

TA的精华主题

TA的得分主题

发表于 2003-7-25 10:50 | 显示全部楼层

TA的精华主题

TA的得分主题

发表于 2003-7-28 11:51 | 显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用  · 内置多项VBA编程加强工具       ★ 免费下载 ★      ★使用手册
人机对战能在EXCEL中实现吗?

TA的精华主题

TA的得分主题

发表于 2003-7-29 11:44 | 显示全部楼层
黑白之道,非常道。吾辈人,难望两位项背。 催人奋进。

TA的精华主题

TA的得分主题

发表于 2003-7-29 12:48 | 显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用  · 内置多项VBA编程加强工具       ★ 免费下载 ★      ★使用手册
以下是引用xiaog在2003-7-28 23:28:00的发言: [quote]以下是引用doyyi在2003-7-28 11:51:00的发言: 人机对战能在EXCEL中实现吗?
应该可以,附算法公式: Dim a As Single Dim b As Single For a = -5 To 20 For b = -5 To 20 If (a < 0) Or (b < 0) Or (a > 15) Or (b > 15) Then table(a, b) = 10 End If Next b Next a For i = 0 To 15 For j = 0 To 15 If comturn = True And wantfive(i, j, 2) = True Then Call goes(i, j) End If Next j Next i '连五子 For i = 0 To 15 For j = 0 To 15 If comturn = True And wantfive(i, j, 1) = True Then Call goes(i, j) End If Next j Next i '阻止对方连五子 For i = 0 To 15 For j = 0 To 15 If comturn = True And table(i, j) * table(i, j + 1) * table(i, j + 2) = 8 And (table(i, j - 1) = 0 And table(i, j + 3) = 0) Then If table(i, j - 2) = 2 Or table(i - 1, j - 1) = 2 Or table(i - 1, j) = 2 Or table(i - 1, j + 1) = 2 Or table(i + 1, j - 1) = 2 Or table(i + 1, j) = 2 Or table(i + 1, j + 1) = 2 Then Call goes(i, j - 1) Else Call goes(i, j + 3) End If ElseIf comturn = True And table(i, j) * table(i + 1, j) * table(i + 2, j) = 8 And (table(i - 1, j) = 0 And table(i + 3, j)) = 0 Then If table(i - 2, j) = 2 Or table(i - 1, j - 1) = 2 Or table(i, j - 1) = 2 Or table(i + 1, j - 1) = 2 Or table(i - 1, j + 1) = 2 Or table(i, j + 1) = 2 Or table(i + 1, j + 1) = 2 Then Call goes(i - 1, j) Else Call goes(i + 3, j) End If ElseIf comturn = True And table(i, j) * table(i + 1, j + 1) * table(i + 2, j + 2) = 8 And (table(i - 1, j - 1) = 0 And table(i + 3, j + 3) = 0) Then If table(i - 2, j - 2) = 2 Or table(i - 1, j) = 2 Or table(i - 1, j + 1) = 2 Or table(i, j - 1) = 2 Or table(i, j + 1) = 2 Or table(i + 1, j - 1) = 2 Or table(i + 1, j) = 2 Then Call goes(i - 1, j - 1) Else Call goes(i + 3, j + 3) End If ElseIf comturn = True And table(i, j) * table(i - 1, j + 1) * table(i - 2, j + 2) = 8 And (table(i + 1, j - 1) = 0 And table(i - 3, j + 3) = 0) Then If table(i + 2, j - 2) = 2 Or table(i - 1, j - 1) = 2 Or table(i, j - 1) = 2 Or table(i - 1, j) = 2 Or table(i + 1, j) = 2 Or table(i + 1, j + 1) = 2 Or table(i, j + 1) = 2 Then Call goes(i + 1, j - 1) Else Call goes(i - 3, j + 3) End If End If Next j Next i '将自己连成四点一线 For i = 0 To 15 For j = 0 To 15 If comturn = True And wantfour(i, j, 2) = True Then Call goes(i, j) End If Next j Next i '将自己连成四点一线 For i = 0 To 15 For j = 0 To 15 If comturn = True And wantfour1(i, j, 2) = True Then Call goes(i, j) End If Next j Next i '叫吃 For i = 0 To 15 For j = 0 To 15 If comturn = True And table(i, j) * table(i, j + 1) * table(i, j + 2) = 1 And (table(i, j - 1) = 0 And table(i, j + 3) = 0) Then If table(i, j - 2) = 1 Or table(i - 1, j - 1) = 1 Or table(i - 1, j) = 1 Or table(i - 1, j + 1) = 1 Or table(i + 1, j - 1) = 1 Or table(i + 1, j) = 1 Or table(i + 1, j + 1) = 1 Then Call goes(i, j - 1) Else Call goes(i, j + 3) End If ElseIf comturn = True And table(i, j) * table(i + 1, j) * table(i + 2, j) = 1 And (table(i - 1, j) = 0 And table(i + 3, j) = 0) Then If table(i - 2, j) = 1 Or table(i - 1, j - 1) = 1 Or table(i, j - 1) = 1 Or table(i + 1, j - 1) = 1 Or table(i - 1, j + 1) = 1 Or table(i, j + 1) = 1 Or table(i + 1, j + 1) = 1 Then Call goes(i - 1, j) Else Call goes(i + 3, j) End If ElseIf comturn = True And table(i, j) * table(i + 1, j + 1) * table(i + 2, j + 2) = 1 And (table(i - 1, j - 1) = 0 And table(i + 3, j + 3) = 0) Then If table(i - 2, j - 2) = 1 Or table(i - 1, j) = 1 Or table(i - 1, j + 1) = 1 Or table(i, j - 1) = 1 Or table(i, j + 1) = 1 Or table(i + 1, j - 1) = 1 Or table(i + 1, j) = 1 Then Call goes(i - 1, j - 1) Else Call goes(i + 3, j + 3) End If ElseIf comturn = True And table(i, j) * table(i - 1, j + 1) * table(i - 2, j + 2) = 1 And (table(i + 1, j - 1) = 0 And table(i - 3, j + 3) = 0) Then If table(i + 2, j - 2) = 1 Or table(i - 1, j - 1) = 1 Or table(i, j - 1) = 1 Or table(i - 1, j) = 1 Or table(i + 1, j) = 1 Or table(i + 1, j + 1) = 1 Or table(i, j + 1) = 1 Then Call goes(i + 1, j - 1) Else Call goes(i - 3, j + 3) End If End If Next j Next i '阻止对方四点一线 For i = 0 To 15 For j = 0 To 15 If comturn = True And wantfour(i, j, 1) = True Then Call goes(i, j) End If Next j Next i '阻止对方四点一线 For i = 0 To 15 For j = 0 To 15 If comturn = True And (want231(i, j, 1) = True _ Or want232(i, j, 1) = True _ Or want233(i, j, 1) = True) Then Call goes(i, j) End If Next j Next i '阻止对方走双飞燕 For i = 0 To 15 For j = 0 To 15 If comturn = True And (want231(i, j, 2) = True _ Or want232(i, j, 2) = True _ Or want233(i, j, 2) = True) Then Call goes(i, j) End If Next j Next i '走双飞燕 For i = 0 To 15 For j = 0 To 15 If comturn = True And wantfour1(i, j, 1) = True Then Call goes(i, j) End If Next j Next i '防止叫吃 For i = 0 To 15 For j = 0 To 15 If comturn = True And wantthree(i, j, 1) = True Then Call goes(i, j) End If Next j Next i '挡对方两子一线的 For i = 0 To 15 For j = 0 To 15 If comturn = True And wantthree(i, j, 2) = True Then Call goes(i, j) End If Next j Next i '连自己两点一线的 For i = 0 To 15 For j = 0 To 15 If comturn = True And table(i, j) = 0 And (table(i - 1, j) * table(i + 1, j) = 1 _ Or table(i - 1, j + 1) * table(i + 1, j + 1) = 1 _ Or table(i, j - 1) * table(i, j + 1) = 1 _ Or table(i + 1, j - 1) * table(i - 1, j + 1) = 1 _ ) Then Call goes(i, j) End If Next j Next i '断 For i = 0 To 15 For j = 0 To 15 If comturn = True And table(i, j) = 0 And (table(i - 1, j) * table(i + 1, j) = 4 _ Or table(i - 1, j + 1) * table(i + 1, j + 1) = 4 _ Or table(i, j - 1) * table(i, j + 1) = 4 _ Or table(i + 1, j - 1) * table(i - 1, j + 1) = 4 _ ) Then Call goes(i, j) End If Next j Next i '粘 For i = 0 To 15 For j = 0 To 15 If comturn = True And table(i, j) = 1 And (table(i - 1, j - 1) = 0 Or table(i, j - 1) = 0 Or table(i + 1, j - 1) = 0 Or table(i - 1, j) = 0 Or table(i + 1, j) = 0 Or table(i - 1, j + 1) = 0 Or table(i, j + 1) = 0 Or table(i + 1, j + 1) = 0) Then If table(i - 1, j - 1) = 0 Then Call goes(i - 1, j - 1) ElseIf table(i + 1, j + 1) = 0 Then Call goes(i + 1, j + 1) ElseIf table(i, j - 1) = 0 Then Call goes(i, j - 1) ElseIf table(i, j + 1) = 0 Then Call goes(i, j + 1) ElseIf table(i + 1, j - 1) = 0 Then Call goes(i + 1, j - 1) ElseIf table(i - 1, j + 1) = 0 Then Call goes(i - 1, j + 1) ElseIf table(i - 1, j) = 0 Then Call goes(i - 1, j) ElseIf table(i + 1, j) = 0 Then Call goes(i + 1, j) End If End If Next j Next i '随意走一步 [/quote] 谢了

TA的精华主题

TA的得分主题

发表于 2003-9-1 22:00 | 显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用  · 内置多项VBA编程加强工具       ★ 免费下载 ★      ★使用手册
黑白之道,非常道。吾辈人,难望两位项背..............咦,人在哪里??????
您需要登录后才可以回帖 登录 | 免费注册

本版积分规则

手机版|关于我们|联系我们|ExcelHome

GMT+8, 2024-11-23 05:26 , Processed in 0.048715 second(s), 10 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 1999-2023 Wooffice Inc.

沪公网安备 31011702000001号 沪ICP备11019229号-2

本论坛言论纯属发表者个人意见,任何违反国家相关法律的言论,本站将协助国家相关部门追究发言者责任!     本站特聘法律顾问:李志群律师

快速回复 返回顶部 返回列表