- 1、本文档共32页,可阅读全部内容。
- 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
PAGE
PAGE 23
PAGE 48
摘 要
五子棋是一种益智游戏,它能增强玩家的思维能力,提高智力,而且富含哲理,有助于修身养性。
本系统的五子棋设置了三种模式,自我对战、人机对战和网络对战。三种模式中都有菜单操作、落子、判断胜负、胜利方棋子闪烁、棋局重现、返回上级菜单和退出的功能,自我对战中设有悔棋的功能;人机对战采用贪心算法,分别算出人和机器的最佳落子位置的分数,并进行相比,当机器最佳落子位置分数高时,机器落子的位置是它自己的分数最高的位置,如果人的最佳落子位置的分数高于机器,那么机器就占用人的最佳落子位置;网络对战模式中一方先建立游戏,作为游戏的服务器端,对方作为客户端连接服务器端,发送五子棋信息主要是五子棋落子坐标和存储棋子的颜色。三种模式都以双向链表栈的形式存储棋子的坐标和落子的颜色,并且有一个二维数组形式的模拟棋盘存储某个位置的落子情况(用颜色来标记,如果没有落子就设置为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 g
您可能关注的文档
- 《深度营销-》-课件设计(公开).ppt
- 《《基于遗传算法的中药药对挖掘系统的设计与实现》》-毕业论文(设计).doc
- 《生态风险评价》-课件设计(公开).ppt
- 《生物八上复习》-课件设计(公开).ppt
- 《《基于遗传算法与模拟退火算法的TSP算法求解10大城市最短旅途》》-毕业论文(设计).doc
- 《生物八上复习58071798》-课件设计(公开).ppt
- 《《基于引力模型中国机电产品出口影响因素实证分析》》-毕业论文(设计).doc
- 《生物必修三复习第5章第4-5节》-课件设计(公开).ppt
- 《《基于用户情感需求的创意干鞋机设计》》-毕业论文(设计).doc
- 《生物必修一1-3章期中复习课件》-课件设计(公开).ppt
文档评论(0)