登录

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

注册

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

找回密码

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

基于Android的数独游戏的设计与实现毕业论文

 2021-06-24 09:06  

摘 要

近几年,移动互联网和手机应用市场日新月异,基于Linux内核的Android系统在此形势下应运而生,并越来越得到手机用户的青睐。相比以往,人们花费更多的时间在手机上,因此,忽略时间、地点的手机小游戏成为一种新的需求。

本课题主要是实现一款运行于Android平台的Sudoku游戏系统。数独是一款古老的游戏,发展到现在有了一定变化,玩家需要在盘面上81个小格子中根据已知数据推理出空格子里的数据,并要求每个3×3的小宫格,行和列都要包括1~9,且不重复。

本文以系统的需求分析为基础,介绍了数独算法的实现,即采用“挖洞”算法生成数独初盘并使用加权规范函数WNF(P)实现数独游戏难度等级的判断。之后采用候选数搜索算法求解数独,其相关算法都采用Java语言编写。另外,本系统采用XML语言实现相关界面的绘制,并使用Shared Preferences对游戏中的数据进行存储。

系统界面运用了极简主义的风格,平面感突出,界面简洁,与用户沟通良好,方便使用。本文的工作对同类Android游戏的开发具有一定的借鉴意义。

关键字:Android ;Java;数独;手机游戏

Abstract

In recent years, mobile Internet and mobile application market have developed fast. In this situation, the Android system based on Linux kernel arises at the historic moment, and earns the favor of cell phone users. Compared with the past, people spend more time on the phone. Therefore, mobile phone games that can be played ignoring time and place become a new kind of demands.

This thesis mainly talks about a system of Sudoku game based on the Android platform. Sudoku is a old game, who’s rule changes when time goes by. Players need to reason about the number in all vacant grids according to the known data on the disk of 81 small grids, and meet each of the 3 x 3 grids, row and column contains the Numbers 1 to 9, and do not repeat.

In this thesis, we describe the implementation algorithm of the game that we adopt the idea of digging holes to create an original layout which was divided into different difficulty ranks by using function WNF. Then, the optimized candidate searching algorithm is used to solve the Sudoku puzzles, its relevant algorithm are all written in Java language. In addition, this system adopts the XML language to realize the drawing of the related interfaces, and uses Shared Preferences to store data in the game.

The system interface is designed in a simple fashion with a minimalist style. And it maintains clear communication with user so that it is easy to operate. This thesis can be used for reference by those who develop the same kind of Android games.

Key Words: Android;Java;Sudoku;mobile phone games

目 录

第1章 绪论 1

1.1 研究背景和意义 1

1.2 国内外研究现状 1

1.3 主要内容 2

第2章 游戏开发平台及相关技术 3

2.1 Android系统简介 3

2.2 Android应用程序组件 4

2.2.1 Activity 4

2.2.2 Intent 4

2.3 SharedPreferences 4

2.4 Activity的生命周期状态 5

2.5 Activity跳转时的状态变化 6

第3章 数独游戏系统的总体设计 8

3.1 系统需求分析 8

3.1.1 公共资源文件设置模块 8

3.1.2 游戏主窗体模块 8

3.1.3 虚拟键盘模块 8

3.1.4 游戏设置模块 9

3.2 游戏整体架构 9

3.3 游戏整体运行流程 9

3.4 游戏主体的运行流程 10

第4章 数独游戏系统的详细分析与设计 11

4.1 系统开发及运行环境 11

4.2 公共资源文件的配置 11

4.3 游戏主窗体模块 11

4.3.1 设计主窗体布局文件 11

4.3.2 启动界面主体类的实现 12

4.4 游戏难度级别选择模块 12

4.5 数独游戏界面的绘制 13

4.5.1 初始游戏界面的绘制 14

4.5.2 处理用户操作事件 15

4.5.3 PuzzleView视图状态保存 15

4.6 虚拟键盘模块 15

4.6.1 设计虚拟键盘布局文件 16

4.6.2 键盘中可选数字的生成 16

4.6.3 处理键盘输入 16

4.7 实现游戏逻辑 17

4.8 继续游戏模块的实现 18

4.8.1 游戏暂停 18

4.8.2 游戏恢复 18

4.8.3 继续按钮的实现 18

4.9 数独算法类的实现 19

4.9.1 数独难度级别判断算法的实现 19

4.9.2 数独生成算法的实现 20

4.10 游戏完成模块 20

4.11 设置模块 21

4.11.1 添加主菜单 21

4.11.2 创建菜单 21

4.11.3 添加设置选项 21

4.11.4 设置选项的保存 22

4.12 关于模块 22

第5章 总结 24

参考文献 25

致 谢 26

第1章 绪论

1.1研究背景和意义

2007年11月5日,Google正式发布Android。自此Android操作系统开始进入人们的视线。2010以后,Android的发展呈突飞猛进之势并在全世界范围内得以大量普及。据2015年Q2 China Smart Phone Market监测报告显示,截至2015年下半年,在中国,智能手机用户突破6亿,达6.01亿,环比增加1.52%,中国智能手机市场销量达到9890万台[1]

同时,在开发游戏方面移动终端具有其独特的优势,其开发的游戏应用没有用户,市场和开发商的限制,其核心在于满足用户休闲娱乐的需要。这些需求没有时间,地域的限制,甚至能穿透文化的壁垒。因此,大量游戏玩家将游戏转移到携带方便的手机终端。如今手机游戏市场竞争最激烈的是 IOS 平台游戏和Android 平台游戏,但据iiMedia Research(艾媒咨询)数据显示,2015下半年,在各操作系统销量占比方面,Android占比为85.2%,远远高于IOS的11.2%。因此Android 系统的设备终端的数量更为庞大,同时也具有要高的市场需求。

另外,游戏的广泛性与传播性会激发潜在的群体,以此来扩大市场并占据市场,广阔的市场也带来了丰厚的利润。2015年手游在全球应用市场总获利中所占比例为85%,达348亿美金,到2016年,预计游戏收入会增长至415亿美金,2020年有望增长至746亿美金[2]。因此手游有着广阔的前景。另外,数独从出现至今,一直备受人们的喜爱,数独所独具的魅力使它拥有数量可观的用户群。因此,相比于纸笔演算的繁琐,设计一款基于Android平台的数独游戏,不仅能够让数独玩家享受随时随地玩游戏的方便快捷,并且具有一定的社会和经济意义。

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

企业微信

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