摘 要
数独(Sudoku)是一种运用纸、笔进行演算的数学智力游戏。玩家需要根据9×9盘面上的已知数字,推理出所有剩余空格的数字,并满足每一行、每一列、每一个小九宫内的数字均含1~ 9,而且不重复。 每一道合格的数独谜题都有且仅有唯一答案,推理方法也以此为基础,任何无解或多解的题目都是不合格的。
随着搭载Android系统的智能手机在中国的普及,不论何时,不论何地,在智能手机端玩数独游戏成为一种方便快捷的新需求。数独游戏出现错误时,必须回退一步或几步并擦除已经填入的大部分数字,在智能手机上玩数独游戏可以随时修改单元格中的数字。数独游戏规则需要根据已有数字进行推理判断,不仅具有很强的趣味性,而且能锻炼我们的逻辑思维能力。
本课题研究设计一款运行在Android 平台的数独游戏软件。该课题主要使用Java语言开发,运行于Android操作系统,实现了数独游戏的基本功能。
关键词:数独;Android;手机游戏;Java
-
ABSTRACT
Sudoku is a math puzzle game played with paper and pen. Players need to be filled 9 × 9 disk with known figures, reasoning other figure out, and meet each row, each column, each small nine intrauterine figures 1 to 9 inclusive, and not repeat. Every qualified Sudoku puzzles only have one unique answer, but also as a basis for reasoning method, no solution or any solution questions are unqualified.
With Android powered smart phones popular in China, no matter when, no matter where, palying sudoku game in the smart phone become a convenient new demands. Sudoku error occurs, or the steps you must take a step back and erase the figures already filled. on the smartphone sudoku can be modified in a cell number. Sudoku rules need to be based on the existing number of reasoning judgment, not only has a strong interest, but also to exercise our ability to think logically.
This study is designed a Sudoku game software to run on the Android platform. Using Java language and runs on the Android operating system, to achieve the basic functions of Sudoku.
Sudoku is a math puzzle game played with paper and pen. According to the filled 9 × 9 disk with known figures, players need to reason out other figures, which must meet each row, each column, each small nine intrauterine figures 1 to 9 inclusive, and not repeat. Every qualified Sudoku puzzle has and only has one unique answer. As a basis for reasoning method, no solution or any other solution questions are unqualified.
With the rapid popularization of android powered smart phones in China, no matter when or where, palying sudoku game in the smart phone becomes a new fashion. When Sudoku error occurs, you must take a step back and delete the figures already filled. Playing Sudoku game on the smart phone, you can conveniently modify the numbers. Sudoku rules must base on the existing number of reasoning judgment, which not only have a strong interest, but also exercise our logical thinking ability.
This paper has designed a Sudoku game with Java language running on the android platform, which has achieved the basic functions of the Sudoku game. Keywords: Sudoku; Android; mobile games; Java
-
湖南科技大学本科生毕业设计(论文)
目 录
第一章 引言 ....................................................................................................... 1
1.1 项目背景 ...................................................................................................................... 1 1.2 项目目的 ...................................................................................................................... 1 1.3 主要内容 ...................................................................................................................... 1
第二章 游戏开发相关技术 ............................................................................... 3
2.1 Android .......................................................................................................................... 3
2.1.1 Android发展历史 ............................................................................................... 3 2.1.2 Android特点与系统架构 ................................................................................... 3 2.1.3 Android基本组件与项目结构 ........................................................................... 5 2.1.4 Android UI设计与其原理 .................................................................................. 7 2.2 Java ................................................................................................................................ 8
2.2.1 Java简介 ............................................................................................................. 8 2.2.2 Java SE ................................................................................................................ 8 2.3 Eclipse ........................................................................................................................... 8 2.3 Android SDK ................................................................................................................. 9
第三章 数独游戏设计 ..................................................................................... 10
3.1 功能需求 .................................................................................................................... 10
3.1.1 继续游戏模块 .................................................................................................. 10 3.1.2 开始游戏模块 .................................................................................................. 10 3.1.3 游戏设置模块 .................................................................................................. 10 3.1.4 游戏完成模块 .................................................................................................. 10 3.1.5 其他模块 .......................................................................................................... 10 3.2 游戏架构设计 ............................................................................................................ 11 3.3 游戏运行流程 ............................................................................................................ 11
第四章 数独游戏实现 ..................................................................................... 13
4.1开发环境搭建 ............................................................................................................. 13
4.1.1 安装JDK和配置Java开发环境 ................................................................... 13 4.1.2 SDK和ADT的安装和配置 ............................................................................ 13 4.2项目工程文件 ............................................................................................................. 14 4.3游戏主界面模块 ......................................................................................................... 16 4.4游戏关卡选择模块 ..................................................................................................... 17 4.5游戏谜题的存储与导入 ............................................................................................. 22 4.6游戏状态存储与恢复 ................................................................................................. 23 4.7游戏界面绘制与逻辑实现 ......................................................................................... 24 4.8游戏结束检测与信息提示 ......................................................................................... 26
-i-
湖南科技大学本科生毕业设计(论文)
4.9游戏设置模块 ............................................................................................................. 29 4.10游戏其他模块 ........................................................................................................... 35
第五章 总结 ......................................................................................................... 2 参 考 文 献 ......................................................................................................... 3 致 谢 ................................................................................................................... 4
-ii-
湖南科技大学本科生毕业设计(论文)
第一章 引言
1.1 项目背景
2007年11月5日,距离苹果发布第一代iPhone手机仅四个月,谷歌公司正式公布Android操作系统,并且宣布与34家手机厂商、运营商成立“开放手机联盟”(OHA),自此基于Linux内核的Android系统正式登上历史舞台。Android平台自2010年以来呈现出突飞猛进的发展势头,在全球智能手机市场中所占份额从不到10%一路猛增至50%以上。2011年,全球智能手机销量首次超过PC电脑的销量。Android已经成为全球智能手机市场的领跑者,截至2012年第一季度的市场份额已超过50%。在这样的情况下,基于Android平台的应用也迅速增长。2012年2月数据显示,Android Market上的应用程序数量突破45万个,Android Market的累计下载量已经突破130亿次,在谷歌电子市场登记的Android开发者已达10W名,Android设备每天激活量达到85万台。
很显然,在这样的市场环境下,Android手机移动游戏开发成为一大产业,也是众多手机用户娱乐的主要项目。数独游戏在日本非常流行,在地铁车厢和候车室里,每天都可以看到人们埋头于游戏的情景,甚至有专门的“数独”游戏机出现。除此之外,很多杂志和报纸上的游戏专版也有数独栏目,不过相对于使用笔和纸来享受数独的乐趣,显然使用手机来玩游戏更具有优势。首先,游戏出现错误时,不再需要橡皮擦擦除可能填错的数字,可以使用键盘随时更改已经填入的数字;其次,免除了找谜题,打印谜题等麻烦步骤,游戏中存储的数独谜题,能够提供给玩家随时随地玩数独游戏的新享受。
本论文即基于此背景而开展的。
1.2 项目目的
随着智能手机的普及,越来越多的普通民众习惯于在手机上完成他们想要做的事情,获取他们想了解的信息,当然,游戏作为一大娱乐项目,从电脑PC端转移到手机移动端,也不是一件稀奇的事情。数独具有庞大的群众基础,简单容易上手,又具有寓教于乐的特点,Android应用开发技术的成熟使也得在基于Android系统的手机上开发一款数独游戏成为可能。本项目的目的是在时下最流行的手机操作系统上开发一款数独游戏,使得玩家可以随时随地方便的体验数独的乐趣。同时,提高自己的实践动手能力和对事物的理解能力。通过此课题的研究,为今后基于Android手机的游戏开发打好基础。
1.3 主要内容
数独游戏有广泛的用户群,游戏本身也很受欢迎。如何运用Android游戏开发技术
-1-