登录

  • 登录
  • 忘记密码?点击找回

注册

  • 获取手机验证码 60
  • 注册

找回密码

  • 获取手机验证码60
  • 找回
毕业论文网 > 毕业论文 > 计算机类 > 物联网工程 > 正文

基于安卓平台的贪吃蛇人机对弈游戏毕业论文

 2021-03-21 09:03  

摘 要

当今社会已经经过了互联网爆发的初始阶段,互联网已经得到了大面积的普及和快速发展,而移动互联网就是现在发展最为迅速和最有前景的领域。近些年来高性能的移动智能终端越来越普及,在生活中几乎每个人都会手拿一部智能手机或者平板电脑,因此基于移动终端的各种应用也就应运而生。

贪吃蛇游戏是一款十分受人喜爱的小游戏,基本的游戏玩法为一个封闭的区域内有一条蛇,玩家控制贪吃蛇的挪动方向来寻觅吃掉区域内的食物,蛇在吃掉食物后身体的长度会增加,并且蛇的移动速度也会相应的加快一些。当贪吃蛇的头部撞到游戏边界时则结束游戏。现在要基于安卓平台实现这个经典的小游戏,并且加入算法控制的人工智能蛇来和玩家共同游戏,规定当玩家控制的蛇头部碰到墙壁或其他蛇的身体时,游戏结束。现在需要寻找合适并且高效智能的算法来设计人工智能蛇。经过分析,选择DFS算法作为贪吃蛇的决策算法。本文主要的研讨的内容有以下两点:

1、完成了基于Android的贪吃蛇单机版应用:该游戏应用是将经典的贪吃蛇游戏实现在安卓平台上,与在传统的电脑端相比较来说,移动终端的优势更为明显:玩家可以通过智能手机或者平板电脑在任何时间和地点进行游戏,感受到游戏的快乐。同时也能够丰富每个人的碎片时间,在快节奏的工作生活中起到娱乐减压的作用。

2、研究分析了适用于移动平台贪吃蛇游戏的智能算法:通过在单机版贪吃蛇基础上添加算法控制的蛇来达到与玩家进行游戏的目的。采用DFS算法来实现贪吃蛇自动寻径的过程。

关键词:游戏人工智能;安卓;贪吃蛇;DFS算法;

Abstract

Society has passed the initial stages of the outbreak of the Internet, the Internet has gained widespread popularity and rapid development of mobile Internet is the fastest-growing and most promising fields now.High-performance mobile intelligent terminal is more and more popular in recent years, almost everyone in life have a smartphone or a tablet, therefore appeared various applications based on mobile terminals.

Snake is a classic popular game, the basic gameplay is in a closed area there is a snake.The player to control the movement of snake to find and eat food in the area. The snake eating food can increase the length of snake body, and the snake's movement speed will speed up some accordingly.While the snake's head hits the wall,then the game is over. To achieve this classic small game on the android platform, and join the artificial intelligence snake controled by algorithm to play with players,.When the player who control the snake touching the wall or other snakes’ body, game is over.Now it is time to find the right and intelligent algorithms to design for artificial intelligence snakes.Through reflection and comparison, I plan to select one of the BFS and greedy algorithms to implement the artificial intelligence snake algorithm.Therefore, the main research content of this article has two aspects:

1. Have done the stand-alone snake game application on android phone: the application is the snake game applied to implement on android phone,compared with the platform of PC, the advantage of the mobile terminal is more apparent: players can through a smartphone or tablet to play this game anywhere at any time,and experience the fun of the game.At the same time, it can enrich the time of each person's shard, and have the effect of reducing stress in the fast-paced work life.

2. Analyzes the intelligent algorithm for the snake game on mobile platform: adding snake controled by algorithm based on single version snake game to achieve the goal of playing with players. Using the BFS algorithm or greedy algorithm to complete the automatic search path of the snake.

Key Words: artificial intelligence of game; android; gluttonous snake; BFS algorithm;A* algorithm

目录

摘 要 I

Abstract II

第1章 绪论 1

1.1 研究背景以及研究目的与意义 1

1.1.1 Android系统的优势性 1

1.1.2 移动端游戏的发展情况 1

1.1.3 基于安卓平台的贪吃蛇人机对弈游戏研究的意义 4

1.2 国内外研究现状 4

1.3 本文主要研究内容 5

1.4 本文结构安排 6

第2章 系统整体分析设计 7

2.1 Android系统相关知识 7

2.1.1 Android应用程序文件结构 7

2.1.2 Activity及相关UI组件介绍 7

2.2 贪吃蛇游戏的核心算法分析 9

2.2.1 深度优先搜索 9

2.2.2 广度优先搜索 10

2.2.3 A*算法 10

2.3 贪吃蛇游戏基本寻路算法 11

2.4 贪吃蛇游戏的需求分析 12

2.4.1 用户需求分析 12

2.4.2 功能需求分析 13

2.4.3 游戏角色分析 13

2.4.4 游戏控制分析 14

2.5 游戏系统架构与各模块设计 14

2.5.1 游戏界面模块 16

2.5.2 游戏控制模块 16

2.6 本章小结 17

第3章 基于Android手机的单机版贪吃蛇游戏的实现 18

3.1 贪吃蛇游戏程序主结构 18

3.2 游戏模块的实现 18

3.2.1 界面模块的实现 18

3.2.2 控制模块的实现 19

3.3 程序类的实现 19

3.3.1 程序类关系图 19

3.3.2 Snake类的设计实现 20

3.3.3 TileView类的详细设计 21

3.3.4 SnakeView类的详细设计 21

3.4 贪吃蛇中的寻径实现 23

3.5 本章小结 23

第4章 系统测试与结果分析 25

4.1 测试的概念 25

4.2 测试的目的 25

4.3 测试方案 25

4.4 测试步骤 26

4.5 贪吃蛇游戏测试 26

4.6 本章小结 28

第5章 总结与展望 29

5.1 总结 29

5.2 展望 29

参考文献 30

致谢 31

第1章 绪论

1.1 研究背景以及研究目的与意义

1.1.1 Android系统的优势性

在实际生活中,有相当一部分的人使用Android系统的手机,因此选择基于Android系统来设计开发这款贪吃蛇游戏。Android系统与其他系统相比较在以下几方面有很大的优势性:

1、开源性:在较为优秀的地方,Android系统最重要的就是开源。系统开源可以让下面有更多地程序人员,伴随着使用者和系统上的APP越来越多,就算是刚刚产生的系统也会十分迅速的迈向成熟。开源对于安卓的发展来说,不仅能够吸引更多的目光,同时对于普通的用户来说,最希望能够拥有的是海量的优质的应用。另外一方面,开源意味着同时会有更多地竞争对手,最终的获益者依然是普通用户,因为这样就可以在手机方面剩下更多的钱。

您需要先支付 80元 才能查看全部内容!立即支付

企业微信

Copyright © 2010-2022 毕业论文网 站点地图