linux游戏设计的意义,《Linux环境下五子棋游戏设计》-毕业论文(设计).doc

PAGE

PAGE 23

PAGE 48

摘 要

五子棋是一种益智游戏,它能增强玩家的思维能力,提高智力,而且富含哲理,有助于修身养性。

本系统的五子棋设置了三种模式,自我对战、人机对战和网络对战。三种模式中都有菜单操作、落子、判断胜负、胜利方棋子闪烁、棋局重现、返回上级菜单和退出的功能,自我对战中设有悔棋的功能;人机对战采用贪心算法,分别算出人和机器的最佳落子位置的分数,并进行相比,当机器最佳落子位置分数高时,机器落子的位置是它自己的分数最高的位置,如果人的最佳落子位置的分数高于机器,那么机器就占用人的最佳落子位置;网络对战模式中一方先建立游戏,作为游戏的服务器端,对方作为客户端连接服务器端,发送五子棋信息主要是五子棋落子坐标和存储棋子的颜色。三种模式都以双向链表栈的形式存储棋子的坐标和落子的颜色,并且有一个二维数组形式的模拟棋盘存储某个位置的落子情况(用颜色来标记,如果没有落子就设置为NONE)。本系统使用Linux环境由C语言来编写,调用Ncurses库来完成五子棋游戏的综合编码。

关键词:自我对战;人机对战;网络对战;Linux;Ncurses

ABSTRACT

Gobang is a puzzle game, it can enhance player's 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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值