ImageVerifierCode 换一换
格式:DOCX , 页数:13 ,大小:141.58KB ,
资源ID:6334717      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/6334717.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(五子棋Java实验报告.docx)为本站会员(b****6)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

五子棋Java实验报告.docx

1、五子棋Java实验报告五子棋Java实验报告五子棋JAVA实验报告 一、实验目的和要求 1、能够用编程语言实现一个简单的五子棋程序 2、在实际系统中使用、实现人工智能的相关算法 3、进一步加深对人工智能算法的理解 二、五子棋的基本常识与原理 1、五子棋的起源 五子棋,是一种两人对弈的纯策略型棋类游戏,亦称“串珠”、“连五子”;是中国民间非常熟知的一个古老棋种。相传,它起源于四千多年前的尧帝时期,比围棋的历史还要悠久。亦有传说,五子棋最初流行于少数民族地区,以后渐渐演变成围棋并在炎黄子孙后代中遍及开来。 五子棋发展于日本,流行于欧美。容易上手,老少皆宜,而且趣味横生,引人入胜;不仅能增强思维能力

2、,提高智力,而且富含哲理,有助于修身养性。 传统五子棋的棋具与围棋相同,棋子分为黑白两色,棋盘为19X19,棋子放置于棋盘线交叉点上。两人对局,各执一色,轮流下一子,先将横、竖或斜线的5个或5个以上同色棋子连成不间断的一排者为胜。因为传统五子棋在落子后不能移动或拿掉,所以也可以用纸和笔来进行游戏。 2、五子棋的基本常识 与任何一种竞技棋一样,五子棋的每一局棋也分为三个阶段:开局,中局和残局。 五子棋的开始阶段称为开局,或称布局。其开局阶段是十分短暂的,大约在七着与十几着之间。在这一阶段的争夺中,双方的布局,应对将对以后的胜负起着极为关键的作用。在开局阶段取得的形势好坏,主动与被动,先手与后手的

3、优劣程度,往往直接影响中局的战斗。因此积极处理好开局和开局向中局的过渡十分重要。 五子棋是从一至五,逐渐布子,发展连系,同时运用限制和反限制的智慧,在连子的过程中为自己的棋子争得相对的主动权和优势,逐步扩展优势,或者从劣势转化为优势,击溃对方的防线,最后连五取胜或抓禁手取胜或迫使对方投子认负。 3、五子棋比赛的相关规定 (1) 职业连珠规则 a. 黑方先下子,白后下,从天元开始相互顺序落子。 b. 最先在棋盘横向、竖向、斜向形成连续的相同色五个棋子的一方为胜。 c. 黑棋禁手判负,白棋无禁手。黑棋禁手包括“三三”(包括“四三三”)、“四四”(包括“四四三”)、“长连”。即黑棋只能以“四三”取胜

4、。 有关术语解释请见图示说明。 d. 如分不出胜负,则定为平局。对局中拔子、中途退场均判为负。 e. 五连与禁手同时形成,判胜。 (2) 比赛中的规定和特例 a. 对局开始前,双方猜子,大数减小数,单数交换,偶数不换。 b. 白棋第一手(即盘面第二着棋)应在天元为界自己一侧布子,主要以示尊重对方,之后rate is low, you should replace the drilling equipment or improve drilling methods. (3) in the course of drilling, drilling water core sampling, bore

5、hole pressure, length and other factors that can fully reflect the characteristics of the rock or concrete are monitored and recorded and submitted to the supervisor. (4) we will according to instructions, to test drill core and concrete-core, and test records and results submitted to the supervisor

6、. (5) we shall each box or two color photo for each core sample, and made detailed records of the drilling operation, should be submitted to the supervisor. (6) the supervisor indicating core that should be saved, stored at the specified location to prevent loss and mixed. 11.3.4 drilling protection

7、 construction drawings shown in all drill holes should be properly protected until acceptance so far. 11.4 water borehole flushing and pressure testing 11.4.1 General requirements (1) prior to the Grouting, all grout hole (above) fissure cleaning and water pressure test. (2) faults, fractures and ot

8、her areas with complex geological conditions, its crack washing the grout hole, should be directed by the supervisor or by field test method. 11.4.2 flushing (1) hole should be flush. We shall be using Feng Shui as directed by supervisor joint flush or catheters into the traffic 双方可任意行子。 c. 对局中双方应遵守

9、“职业连珠五子棋规则”,如出现争议,应由裁判判定。 d. 对局中掉子(棋子掉落在棋盘上)的一方判负。如遇推子或蹭子,以盘面第一落点为准。用手将棋子扶正不算违规。 e. 对局中应礼貌行棋,防止不正常声音、动作影响对方思考。 f. 比赛结束后,双方应将各自棋子放回原处。 g. 对局中如黑方出现禁手,白方应立即指出禁手点,黑方即负。如白方在黑方出现禁手后,又下一步白子,黑棋禁手则不成立了。 h. 比赛对局时间,双方分别为15分钟、1小时、2小时、5小时四个等级标准,超时判负。 (3) 特殊规定 职业五子棋虽然对黑棋采取了种种限制,但黑子先行的优势依然很大。因此,在高段位的职业比赛中,又出现了三种特殊

10、的规定。 a. 指定打法:是指比赛双方按照约定好的开局进行对弈,由白棋先行。 b. 三手可交换:是指黑棋下盘面第3手棋后,白方在下第四手之前,如感觉黑方棋形不利于己方,可提出交换,即执白棋一方变为执黑棋一方,而黑方不可以不换。 c. 五手两打法:是指黑棋在下盘面上关键的第5手棋时,必须下两步棋,让白棋在这两步棋中拿掉一粒棋子,然后再继续对弈。一般说来,白棋肯定拿掉对白方不利的一点,而保留对黑方较为不利的那点让黑方行棋。 三、五子棋的系统设计 1、系统用例模型设计 五子棋系统应该具有选择玩家先落子还是电脑先落子的功能,应该具有开始游戏和重新开始的功能,当然了,必须具有在玩家指定位置落子的功能。以

11、上描述,用用例图在图1中做进一步描述。这部分功能,主要通过界面与系统的交互来实现。 落子选择玩家先落子开始游戏玩家选择电脑先落子重新开始图1 五子棋系统的玩家用例图 各个用例,简单描述如下: rate is low, you should replace the drilling equipment or improve drilling methods. (3) in the course of drilling, drilling water core sampling, borehole pressure, length and other factors that can fully

12、reflect the characteristics of the rock or concrete are monitored and recorded and submitted to the supervisor. (4) we will according to instructions, to test drill core and concrete-core, and test records and results submitted to the supervisor. (5) we shall each box or two color photo for each cor

13、e sample, and made detailed records of the drilling operation, should be submitted to the supervisor. (6) the supervisor indicating core that should be saved, stored at the specified location to prevent loss and mixed. 11.3.4 drilling protection construction drawings shown in all drill holes should

14、be properly protected until acceptance so far. 11.4 water borehole flushing and pressure testing 11.4.1 General requirements (1) prior to the Grouting, all grout hole (above) fissure cleaning and water pressure test. (2) faults, fractures and other areas with complex geological conditions, its crack

15、 washing the grout hole, should be directed by the supervisor or by field test method. 11.4.2 flushing (1) hole should be flush. We shall be using Feng Shui as directed by supervisor joint flush or catheters into the traffic , 选择电脑先落子:选择后,在游戏过程中,由电脑执黑子,先落子;玩家执白子,于电脑后落子; , 选择玩家先落子:选择后,在游戏过程中,由玩家执黑子,先

16、落子;电脑执白子,于玩家后落子; , 落子:原则上说,只要不违反禁手规则,在玩家鼠标点击最近的落子点落子,但是在本系统中,简单起见,没有考虑禁手规则; , 开始游戏:选择后,根据设定的电脑还是玩家先落子,开始游戏; , 重新开始:在游戏途中,可以选择重新开始,中断游戏并重新开始游戏。 同时,五子棋系统本身应该具有棋盘绘制、棋势扫描、棋势排序、棋势评估、择位落子,以及胜负判定的功能,尤其是对于棋势排序、棋势评估和择位落子,这里是体现五子棋系统人工智能(AI)的关键之处。以上描述,用用例图在图2中进一步描述。 棋势排序棋势扫描棋势评估五子棋系统棋盘绘制择位落子胜负判定图2 五子棋系统的系统用例图

17、各个用例,简单描述如下: , 棋盘绘制:绘制19*19的棋盘及相关按钮和选项,并负责电脑、玩家落子后棋子的具体绘制; , 棋势扫描:扫描目前棋盘上的所有八个方向上的落子情况,获取整个对弈双方的棋势; , 棋势排序:对获取的八个方向的棋势(实际上下合一,左右合一,左下右上合一,坐上右下合一,为四个方向),进行排序,便于进行棋势评估; , 棋势评估:分别对电脑和玩家的棋势进行评估,量化棋势; , 择位落子:比较电脑和玩家的棋势,若有利于玩家,则采取“守、堵”的策略,若有利于电脑,则采取“攻、走”的策略; , 胜负判定:每次电脑或是玩家落子后,判断胜负情况,若出现“五子连珠”,则“连珠”一方取胜,另

18、一方失败,游戏结束。 2、系统界面设计 为了实现玩家的用例所需要的功能,同时又便于使用,五子棋系统的界面设计得比较简单,如图3所示。 rate is low, you should replace the drilling equipment or improve drilling methods. (3) in the course of drilling, drilling water core sampling, borehole pressure, length and other factors that can fully reflect the characteristics o

19、f the rock or concrete are monitored and recorded and submitted to the supervisor. (4) we will according to instructions, to test drill core and concrete-core, and test records and results submitted to the supervisor. (5) we shall each box or two color photo for each core sample, and made detailed r

20、ecords of the drilling operation, should be submitted to the supervisor. (6) the supervisor indicating core that should be saved, stored at the specified location to prevent loss and mixed. 11.3.4 drilling protection construction drawings shown in all drill holes should be properly protected until a

21、cceptance so far. 11.4 water borehole flushing and pressure testing 11.4.1 General requirements (1) prior to the Grouting, all grout hole (above) fissure cleaning and water pressure test. (2) faults, fractures and other areas with complex geological conditions, its crack washing the grout hole, shou

22、ld be directed by the supervisor or by field test method. 11.4.2 flushing (1) hole should be flush. We shall be using Feng Shui as directed by supervisor joint flush or catheters into the traffic 整体界面为一个19*19的棋盘,在f-06、f-14、j-10、n-06、n-14这五个位置画了一个小方块,以提醒玩家棋盘的中央位置,便于把握有利位置落子。 在棋盘的右侧是一些控制和提醒选项、按钮和对弈状态标

23、签。 其中,选项有“我是老大我先来”和“让让电脑也无妨”两个。选择前者,则玩家先落子;选择后者,则电脑先落子。 按钮有“人机对战,快冲啊”和“不行了,那重来吧”两个。单击前者,则游戏开始;单击后者,则中断游戏,重新开始。 标签有“就不告诉你是谁赢了”和“就不告诉你这是第几步”两个。前者是在游戏分出胜负后,显示是黑方取胜还是白方取胜;后者是在游戏过程中,不论是电脑落子还是玩家落子,都提示现在是第几步落子。 图3 五子棋系统界面 3、系统模块设计 为了实现五子棋系统本身具有的功能,将系统分为这几个模块:五子棋主模块、棋势扫描模块、棋势排序模块、棋势评估模块以及随机落子模块。其中,五子棋主模块实现棋

24、盘绘制、胜负判定的功能,以及对弈过程中对比双方棋势的择位落子模块。棋势扫描模块、棋势排序模块、棋势评估模块分别实现棋势扫描、棋势排序、棋势评估的功能;而随机落子模块则实现在前两步棋势尚未形成时,电脑紧邻玩家落子位置随机择位落子的功能,是用例图中择位落子功能的一部分。 对应的,系统一共有五个类,分别对应五个模块;分别为:五子棋主模块Gobang类、棋势扫描StatusScan类、棋势排序StatusSort类、棋势评估StatusEvaluation类,以及随机落子RandomPlay类。类图如图4所示。 其中Gobang类中的属性和方法并没有完全列出,只列出了主要的属性和方法;其余类rate

25、is low, you should replace the drilling equipment or improve drilling methods. (3) in the course of drilling, drilling water core sampling, borehole pressure, length and other factors that can fully reflect the characteristics of the rock or concrete are monitored and recorded and submitted to the s

26、upervisor. (4) we will according to instructions, to test drill core and concrete-core, and test records and results submitted to the supervisor. (5) we shall each box or two color photo for each core sample, and made detailed records of the drilling operation, should be submitted to the supervisor.

27、 (6) the supervisor indicating core that should be saved, stored at the specified location to prevent loss and mixed. 11.3.4 drilling protection construction drawings shown in all drill holes should be properly protected until acceptance so far. 11.4 water borehole flushing and pressure testing 11.4

28、.1 General requirements (1) prior to the Grouting, all grout hole (above) fissure cleaning and water pressure test. (2) faults, fractures and other areas with complex geological conditions, its crack washing the grout hole, should be directed by the supervisor or by field test method. 11.4.2 flushin

29、g (1) hole should be flush. We shall be using Feng Shui as directed by supervisor joint flush or catheters into the traffic 基本列出了所有的属性和方法。具体细节将在第四部分“五子棋的实现与测试”一节讨论,这里不再赘述。 图4 五子棋系统的类图 四、五子棋的实现与测试 1、Gobang类的实现 Gobang类是五子棋的核心类,棋盘绘制、棋子落子,响应事件的处理,游戏的控制和模式设置,胜负判定,以及对棋势扫描、排序、评估等的调用都在这里实现。Gobang类的类图如图5所示。

30、图5 Gobang类类图 rate is low, you should replace the drilling equipment or improve drilling methods. (3) in the course of drilling, drilling water core sampling, borehole pressure, length and other factors that can fully reflect the characteristics of the rock or concrete are monitored and recorded and

31、submitted to the supervisor. (4) we will according to instructions, to test drill core and concrete-core, and test records and results submitted to the supervisor. (5) we shall each box or two color photo for each core sample, and made detailed records of the drilling operation, should be submitted

32、to the supervisor. (6) the supervisor indicating core that should be saved, stored at the specified location to prevent loss and mixed. 11.3.4 drilling protection construction drawings shown in all drill holes should be properly protected until acceptance so far. 11.4 water borehole flushing and pressure testing 11.4.1 General requirements (1) prior to the Grouting, all grout hole (above) fissure cleaning and water pressure test. (2) faults, fractures and other areas with complex geological condition

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1