毕业设计
当前位置:首页 > 文秘写作 > 毕业设计 > 列表页

斗地主毕业设计总结

小草范文网  发布于:2017-03-25  分类: 毕业设计 手机版

篇一:cocos2d-x的斗地主游戏开发

编号:

毕业设计(论文)说明书

题 目: 基于Cocos2d-x的

斗地主游戏开发

学 院:数学与计算科学学院

专 业: 信息与计算科学

学生姓名: 李光挺

学 号:1000710117

指导教师单位:数学与计算科学学院

指导教师: 宁黎华

职 称: 讲 师

题目类型: 理论研究

实验研究

2014 年5 月28 日

摘 要

随着智能设备平台的普及、用户数量的增多,智能平台的应用,尤其是游戏异常火爆。斗地主是一款风靡全国的纸牌游戏,玩法简单,娱乐性强,老少皆宜。要开发一款斗地主游戏,如何才能一次开发,多个平台复用?无论从成本或效率考虑,cocos2d-x无疑是一个最佳选择。cocos2d-x是一个跨平台的游戏引擎,它在国内手机游戏开发使用的份额接近70%,而国外使用份额则是接近25%,在苹果APP排行榜top10里面,有7个都是用cocos2d-x引擎开发的。

基于此,本文主要开发和研究一款基于cocos2d-x的斗地主游戏,游戏分为网络和单机两个版本供玩家选择。主要包括自动发牌、玩家叫分、出牌选牌、再玩一局等基本功能,网络版还需实现用户登录注册及验证、网络通信,单机版则实现电脑AI的人工智能(电脑可以自动出牌)。开发所使用的语言是C++,软件需要使用Cocos2d-x游戏引擎库,只涉及到引擎的一些基本动作、精灵、导演、场景、布景层及数据存储等基本技术。本游戏设计的主要重点和难点是出牌选牌、网络通信及电脑AI的人工智能,其中网络通信主要通过SOCKET编程和多线程(接收线程)技术,出牌选牌主要通过实现判断牌的类型、找出牌的类型、比较牌的大小等算法,电脑AI的设计主要通过设定一系列出牌和跟牌的优先级算法来实现人工智能。游戏界面友好,操作简便,娱乐性强,可移植到多个平台,特别是手机单机版在不失娱乐性的同时还省了流量。

关键字:斗地主;cocos2d-x;跨平台;人工智能

Abstract

With the popularity of intelligence devices platforms, increasing the number of users, the application of intelligence platform, especially games are booming. Landlords is a popular card game across the country with simple playing method and rich entertainment, suitable for all ages.Exploiting a Landlords game, how to do the primary deveploment, multiple platforms application, cocos2d-x is undoubtedly the best choice not just cost but also efficiency considerations.Cocos2d-x is a cross-platform game engine, possessing about 70% share of the domestic mobile phone game developers users, while 25% inabroad. In Apple APP ,there are seven cocos2d-x engine development in Ranking Top10.

Based on this, this paper mainly exploits and researches Landlords game based on cocos2d-x, the game is divided into two networks and standalone versions for players to choose from. Including the basic functions of automatic licensing, call points, play and choose cards,play again, and so on, the network version even needed to achieve registration and user login authentication, network communications, stand-alone version can realize the Artificial Intelligence of AI computer (computer can automatically play the cards). Language used is C + +, the software requires the use of Cocos2d-x game engine, only involves some basic moves, agility, director, scene, scene data storage layer and the basic technology of the engine.The main important and difficult points of the game design is selecting cards, network communications and artificial intelligence of computer AI, network communication is achieved mainly by SOCKET programming and multithreading (receiving thread) technology; the card selected is mainly realized by judging and finding out the type of the card,comparing the seize of the card; the design of computer AI is mainly through the priority algorithm of series of playing and following the caeds to achieve artificial intelligence. The game has the advantages of harmonious interface, easy operation, rich entertainment, and also can be ported to multiple platforms.

Keywords: Landlords; cocos2d-x; cross-platform; Artificial Intelligence

引言 ............................................................................................................. 1 1 绪论 ........................................................................................................................................ 2

1.1 课题研究意义 ....................................................................................................................... 2

1.2 国内外研究现状 ................................................................................................................... 2

1.3 可行性分析 ............................................................................................................................ 3 2 相关技术背景 ................................................................................................................... 4

2.1 Cocos2d-x简介 ...................................................................................................................... 4

2.2 数据结构及算法 ................................................................................................................... 5

2.3 SOCKET及多线程编程...................................................................................................... 6

2.3.1 SOCKET编程 .................................................................................................................... 6

2.3.2 多线程编程 ........................................................................................................................ 8 3 开发环境的配置 ............................................................................................................. 9

3.1 开发环境的配置..................................................................................................... 9

3.1.1 Windows下的开发环境配置 ....................................................................................... 10

3.1.2 Android下的开发环境配置 .......................................................................................... 13 4 总体设计 ........................................................................................................................... 16

4.1 软件的构建 .......................................................................................................................... 16

4.1.1 模块的构建 ...................................................................................................................... 17

4.1.2 功能的构建 ...................................................................................................................... 18

4.2 软件的框架 .......................................................................................................................... 20 5 软件设计与实现(详细设计) ................................................................................... 21

5.1 数据结构及算法的设计 ................................................................................................... 21

5.2 数据库的设计 ..................................................................................................................... 22

5.3 模块的设计与实现 ............................................................................................................ 23

5.3.1 用户登录注册及验证模块 ........................................................................................... 23

5.3.2 网络通信模块 .................................................................................................................. 24

5.3.3 自动发牌模块 .................................................................................................................. 26

5.3.4 玩家叫分模块 .................................................................................................................. 27

5.3.5 出牌选牌模块 .................................................................................................................. 28

5.3.6 人工智能模块 .................................................................................................................. 29

5.3.7 重玩模块 ........................................................................................................................... 31 6 软件测试 ........................................................................................................................... 32

6.1 测试环境 .................................................................

斗地主毕业设计总结

............................................................. 32

6.2 测试准则 .............................................................................................................................. 32

6.3 功能测试 .............................................................................................................................. 32

6.3.1 登录验证功能的测试 .................................................................................................... 32

6.3.2 自动发牌功能的测试 .................................................................................................... 33

6.3.3 叫分功能的测试 ............................................................................................................. 34

6.3.4 托管功能的测试 ............................................................................................................. 35

6.3.5 提示功能的测试 ............................................................................................................. 35

6.3.6 重选功能的测试 ............................................................................................................. 36

6.3.7 电脑智力的测试 ............................................................................................................. 37 7 总结 ...................................................................................................................................... 38 谢 辞......................................................................................................................................... 39 参考文献 ................................................................................................................................... 40 附 录......................................................................................................................................... 41

篇二:毕业论文--斗地主游戏设计

东华理工大学长江学院

毕 业 设 计

题 目: 斗地主游戏设计

英文题目:Landlord game design

学生姓名:

学 号:

专 业: 信息工程

系 别:信工系

指导教师: 职称:讲 师

二零一一年六月

摘 要

随着科技的进步,计算机已经普及每个家庭,而计算机游戏也随之越来越多,越来越丰富。网络游戏、单机游戏等休闲游戏让众多人喜欢,而斗地主也受广大群众的追捧。

“斗地主”是流行于全国的一种扑克游戏,玩法简单,娱乐性强,老少皆宜。据传在万恶的旧社会,地主横行乡里,无恶不做,人们为了发泄对地主的痛恨,常常在一天的劳作之后,一家人关起门来"斗地主"。该游戏由三个人玩,用一副或两副牌,地主为一方,其余两家为另一方,双方对战,先出完牌的一方获胜。

本设计以一副牌规则为准.本论文讲述了单机版斗地主的游戏算法的设计,以Visual C++语言编译的一个应用程序。使用者可以简单方便的实现斗地主游戏。本程序界面友好,操作简单,比较实用。

本程序在详细设计时不断地修正和完善,经过测试阶段反复调试和验证,最终形成达到设计要求的可行系统。

关键字:斗地主; 纸牌; Visual C++

ABSTRACT

With the progress of science and technology,Computers have universal every family,and with more and more computer games,increasingly rich。The network game, LAN game and other casual games for many people like it,but Landlord also affected by the broad masses in both hands。

“Landlord” is a popular poker game national,play simple, entertaining is strong,enjoyed by young and old。Reportedly, the landlord of the old society in the root of evil, no hooliganism village don't do, people to vent the hate for landlords in the day, often after work, family behind closed doors " Landlord "。The game consists of three people playing, use a pair or two pairs of CARDS, landlords and the rest for the party to the other party, the two sides, first out CARDS against the party after winning。

This design with a deck rules shall prevail. This paper tells the stand-alone Landlord game algorithm is designed to Visual c + + language compiled an application. Users can simple to realize Fight the Landlord game. This procedure friendly interface, the operation is simple, is more practical。

This procedure in the detailed design constantly correction and perfect when, after testing phase repeated commissioning and validation, and finally form the feasible system to meet the design requirements。

Key word: Landlord; Cards; Visual c + +

目 录

绪论?????????????????????????????????? 1

1. 系统设计的目的及设计思路?????????????????????? 2

1.1 设计目的???????????????????????????? 2

1.2 设计思路???????????????????????????? 2

1.3 系统预览???????????????????????????? 3

2. 系统开发工具及其介绍???????????????????????? 4

2.1 开发工具的选择????????????????????????? 4

2.2 Visual C++编程特点??????????????????????? 5

2.2.1 C++语言的发展??????????????????????? 5

2.2.2 Visual C++ 6.0简介???????????????????? 5

2.2.3 Visual C++ 6.0的开发环境????????????????? 6

3. 需求分析及可行性分析???????????????????????? 7

3.1 需求分析???????????????????????????? 7

3.1.1 需求分析的作用?????????????????????? 7

3.1.2 需求分析过程??????????????????????? 7

3.1.3 需求分析的方法?????????????????????? 7

3. 2 可行性分析???????????????????????????8

3.2.1 可行性分析的意义?????????????????????8

3.2.2 可行性分析报告??????????????????????8

3. 3 系统定义????????????????????????????9

3. 4 系统的组成和功能构想??????????????????????9

4. 系统总体设计方案??????????????????????????10

4.1 C/S模式???????????????????????????? 10

4.1.1 C/S模式????????????????????????? 10

4.1.2 设计原则????????????????????????? 10

4.2 基于C/S的模块设计???????????????????????10

4.2.1 服务器端模块设计????????????????????? 10

4.2.2 客户端模块设计?????????????????????? 11

5. 纸牌设计?????????????????????????????? 13

5.1 纸牌的设计?????????????????????????? 13

5.2 纸牌的出牌类型???????????????????????? 13

6. 详细设计与系统实现????????????????????????? 15

6.1 出牌记录和合法???????????????????????? 15

6.1.1 出牌记录和合法性?????????????????????15

6.2 显示信息功能????????????????????????? 17

6.2.1 分牌???????????????????????????17

6.2.2 产生地主????????????????????????? 19

6.2.3 牌面显示????????????????????????? 21

6.2.4 出牌显示????????????????????????? 21

6.2.5 非法出牌显示??????????????????????? 21

6.2.6 胜负得分判定??????????????????????? 22

结 论???????????????????????????????? 25 致 谢???????????????????????????????? 26 参考文献??????????????????????????????? 27

篇三:单机版斗地主的游戏算法的设计毕业设计论文

摘 要

随着科技的进步,计算机已经普及每个家庭,而计算机游戏也随之越来越多,越来越丰富。网络游戏、单机游戏等休闲游戏让众多人喜欢,而斗地主也受广大群众的追捧。

本设计以一副牌规则为准,将整个游戏按照发牌,叫牌,拆牌,以及出牌的流程划分为4个部分,开始时由系统调用发牌函数每人随机分到17张牌,留存3张底牌,然后电脑AI根据自己手上牌值与牌型结合给定权值决定是否叫三张底牌当地主。一旦叫牌成功,剩下两玩家就是农民,联合“斗地主”。双方以是否出完牌来决定胜负。如果地主的20张牌都出完了,则地主一方胜;如果两个农民中任何一人手中的17张牌出完了,则农民一方胜出。

本论文主要讲述了单机版斗地主的游戏算法的设计,以Visual C++语言编译的一个应用程序。使用者可以简单方便的实现斗地主游戏。本程序界面友好,操作简单,比较实用。

本程序在详细设计时不断地修正和完善,经过测试阶段反复调试和验证,最终形成达到设计要求的可行系统。

关键词: 斗地主;纸牌; Visual C++;游戏核心算法

Abstract

With the progress of science and technology, computers have universal every family, and with more and more computer games, increasingly rich.The network game, LAN game and other casual games for many people like it, but Landlord also affected by the broad masses in both hands.

This design will be subject to rules of a deck of cards, the entire game in accordance with the licensing, call, cards, as well as the process is divided into four parts.Licensing function is called by the system at the beginning, then 17 cards are randomly assigned to each person and three cards are also retained. After that, the computer AI decides whether to call cards based on it's own cards value and the cards type which all have a particular weight.Once the call is successful, the remaining two players is farmers, jointing "Landlords". Whether the two sides finish cards determine the winner. If the landlord's 20 cards are finished, the landlord side win; If any one of the two farmers finishes 17 cards , the farmers win. This paper tells the stand-alone Landlord game algorithm is designed to Visual c + + language compiled an application. Users can simple to realize Fight the Landlord game. This procedure friendly interface, the operation is simple, is more practical. This procedure in the detailed design constantly correction and perfect when, after testing phase repeated commissioning and validation, and finally form the feasible system to meet the design requirements.

Key Words: Fight the landlord; Cards; Visual C++; Game core algorithm

目录

1 绪论

1.1 课题背景....................................................... 1

1.2 研究现状....................................................... 1

1.3 研究项目及意义................................................. 1

1.4 本文的结构安排................................................. 1

1.5 系统开发工具及其介绍........................................... 2

1.5.1 开发工具的选择............................................ 2

1.6 Visual C++编程特点............................................. 3

1.6.1 C++语言的发展................................................. 3

1.6.2 Visual C++ 6.0简介 ........................................... 3

1.6.3 Visual C++ 6.0的开发环境 ..................................... 4

2 斗地主基本知识.................................................... 4

2.1 斗地主规则...................................................... 4

2.2游戏流程框架 .................................................... 5

3 主要模块.......................................................... 6

3.1发牌 ............................................................ 6

3.1.1 第一发牌方案.................................................. 6

3.1.2第二发牌方案 .................................................. 7

3.1.3 发牌算法的代码实现............................................ 8

3.2 叫牌........................................................... 10

3.2.1 叫牌判断..................................................... 10

3.2.2 牌型估值..................................................... 10

3.3 拆牌........................................................... 14

3.3.1拆牌原因 ................................................. 14

3.3.2寻找拆牌方案 ............................................. 15

3.3.3 拆牌实例..................................................... 22

3.4 出牌........................................................... 22

3.4.1 出牌方法产生............................................. 22

3.4.2 产生方法................................................. 23

3.4.3效率问题 ................................................. 24

3.4.4逐个产生和全部产生 ....................................... 24

3.4.5内存使用 ................................................. 25

4 结论及展望....................................................... 25

致谢............................................................... 27

参考文献........................................................... 28

1 绪论

1.1 课题背景

“斗地主”起源于湖北,据传是一位叫吴修全的年轻人,根据当地流行的扑克玩法“跑的快”改编的。由于其游戏规则简单、娱乐性强、老少皆宜,如今已风靡整个中国,并流行于互联网上。具体规则为:由三人玩一副牌,其中一方作为地主,另外两方联合作为农民向地主对抗。开始时每人随机分到17张牌,然后各玩家根据自己手上牌的好坏决定是否叫三张底牌当地主。一旦叫牌成功,剩下两玩家就是农民,联合“斗地主”。双方以是否出完牌来决定胜负。如果地主的20张牌都出完了,则地主一方胜;如果两个农民中任何一人手中的17张牌出完了,则农民一方胜出。

1.2 研究现状

随着电脑软硬件技术和互联网的飞速发展,电脑游戏也突飞猛进,成功游戏不断涌现。比较成熟的大型游戏主要有:反恐精英(CS)、星际争霸、魔兽争霸2、FIFA2003、帝国时代、FIFA2004等等。这时也出现了越来越多的网络小游戏,休闲类项目包括网络围棋、中国象棋、四国军棋、桥牌、麻将、拱猪、拖拉机、斗地主等。

各式各样的游戏给我们的生活带来了无限的乐趣,但同时也出现了一些问题。虽然计算机电脑已经普及绝大多数家庭,但有些偏远的地方却无法正常的接受到网络信号,这就给一部分人带来了有电脑不能上网休闲的烦恼。因此,一些单机游戏更受到了人们的追捧。本设计的目的是用简单的C语言设计出一个斗地主的小游戏,使用者只要运行该程序,就可以轻松的玩游戏了。

1.3 研究项目及意义

“斗地主”属于不完全知识博弈,意思是指参与的三方一开始都不清楚对手手中有什么牌。作为全国广泛流传且具有中国特色的一个牌类游戏,被当做计算机技术的研究对象却是不常见的。本设计旨在分析“斗地主”AI程序的各个必要部分,以“斗地主”的游戏规则为基础,给出各部分的初级探讨,给出一个较有效的“斗地主”AI程序。重点研究拆牌算法,并做出相应的分析、设计和实现。

1.4 本文的结构安排

结合引言部分,参看各节的标题可以知道,本论文是由引言、本论、结论三

本文已影响