- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
摘 要
五子棋是一种益智游戏,它能增强玩家的思维能力,提高智力,而且富含哲理,有助于修身养性。
本系统的五子棋设置了三种模式,自我对战、人机对战和网络对战。三种模式中都有菜单操作、落子、判断胜负、胜利方棋子闪烁、棋局重现、返回上级菜单和退出的功能,自我对战中设有悔棋的功能;人机对战采用贪心算法,分别算出人和机器的最佳落子位置的分数,并进行相比,当机器最佳落子位置分数高时,机器落子的位置是它自己的分数最高的位置,如果人的最佳落子位置的分数高于机器,那么机器就占用人的最佳落子位置;网络对战模式中一方先建立游戏,作为游戏的服务器端,对方作为客户端连接服务器端,发送五子棋信息主要是五子棋落子坐标和存储棋子的颜色。三种模式都以双向链表栈的形式存储棋子的坐标和落子的颜色,并且有一个二维数组形式的模拟棋盘存储某个位置的落子情况(用颜色来标记,如果没有落子就设置为NONE)。本系统使用Linux环境由C语言来编写,调用Ncurses库来完成五子棋游戏的综合编码。
关键词:自我对战;人机对战;网络对战;Linux;Ncurses
ABSTRACT
Gobang is a puzzle game, it can enhance players thinking ability, improve intelligence, and high in philosophy, helps to one’s self-cultivation.
This version of the gobang is set up three kinds of mode, man_vs_man, man_vs_computer and network play. Three kind of modes all have function of the menu operation, chess down, victory judgment, chess flash when win, chess reshow, returning to previous menu and exiting. Man_vs_man mode has taken back function. Man_vs_computer mode adopts greedy algorithm that calculates scores of man and computer of their best location to put down chess respectively. Compare man’s score and score of computer, if score of computer is higher than man’s, then computer puts its chess down to its best location, otherwise, computer will put its chess down to man’s best location. In the mode of network play, one side is to be established as a game server side first, then the other as the client to connect the server side, each message they send to each other is contains the color and the coordinate of the chess that put down last time. Three kinds of modes all store their chess color and chess location in a two-way chain table of stack, and available in the form of a two-dimensional array simulation board stored somewhere chess put down and its color (use color to mark, if it does not move later is set to NONE). This topic uses the Linux environment by C language to write, call the Ncurses functions library can accomplish comprehensive coding of gobang game .
Keywords:Man_vs_man; m
您可能关注的文档
最近下载
- 九年级数学秋季开学第一课(北师大版).pptx
- 部编人教版八年级上册道德与法治全册新质教学课件(配2025年秋改版教材).pptx
- 第1讲 我爱你中国(第一课时)美丽中国是我家(课件)-《新时代中国特色社会主义思想学生读本(小学低年级)》.pptx VIP
- 大学毕业论文_外文文献及中文翻译-财务风险的重要性how important is financial risk.doc VIP
- 人美版(2024)一年级美术上册第一单元《1.1介绍我自己》教学设计.docx VIP
- 民警进幼儿园安全讲课.pptx VIP
- 2024全国职业院校技能大赛ZZ055导游服务赛项规程+赛题 (2).docx VIP
- 计算机网络基础 龚娟 第2章 数据通信基础.ppt VIP
- 沙田柚种植技术最新完整版本.pptx VIP
- DBJ52_T103-2021:模块化箱式房屋安装及验收技术标准.pdf VIP
文档评论(0)