仰恩大学毕业设计(论文)I摘要近年来,Java作为一种新的编程语言,以其简单性、可移植性和平台无关性等优点,得到了广泛地应用,特别是Java与万维网的完美结合,使其成为网络编程和嵌入式编程领域的首选编程语言。eclipse是IBM公司用于快速开发Java应用的一款优秀的集成开发环境,它以其友好的开发界面、强大的组件支持以及开源等优点,得到广大程序员的接受和认可。“贪吃蛇”游戏是一个经典的游戏,它因操作简单、娱乐性强而广受欢迎。本文基于Java技术和eclipse开发环境,开发了一个操作简单、界面美观、功能较齐全的“贪吃蛇”游戏。整个游戏程序分为二个功能模块,八个类模块,实现了游戏的开始、暂停、结束。通过本游戏的开发,达到学习Java技术和熟悉软件开发流程的目的。本文在介绍Java相关技术和国内外发展现状的基础上,对“贪吃蛇”游戏的整个生命周期的各个开发阶段进行了详细地介绍。首先,分析了开发本游戏软件的可行性,重点分析本设计所采用的技术的可行性。其次,从游戏主界面等几方面,分析了本游戏的功能需求;从可使用性和安全性方面分析了属性需求。然后,进行了游戏的概要设计和详细设计,这也是本文的重点。概要设计给出二个功能模块的主框架以及八个类模块的函数调用关系;详细设计介绍了Java2标准运行环境的配置,重点给出各个类模块的程序列表,介绍了各个类包含的变量、使用的方法,展示了游戏的界面。为了保证程序代码的正确性和功能实现的可靠性,本文还介绍了游戏软件的程序调试过程和功能测试结果。关键词:Java;eclipse;贪吃蛇;开发流程仰恩大学毕业设计(论文)IISnakegamedesignanddevelopmentAbstractInrecentyears,Java,asanewprogramminglanguage,withitssimplicity,portabilityandplatformindependenceandotheradvantages,hadbeenusedwidely,especiallyJavaandtheperfectcombinationoftheworldwideweb,tomakeitanetworkprogrammingandembeddedprogrammingfieldpreferredprogramminglanguage.EclipseisIBMusedforfastdevelopmentJavaapplicationofagoodintegrateddevelopmentenvironment,withitsfriendlydevelopmentinterface,powerfulcomponentssupportandopensourceetc,andreceivetheacceptedandapprovedbytheprogrammer.Snakegameisaclassicgame,itwassimpleoperation,strongandpopularentertainment.Thispaper,basedontheJavatechnologyandeclipsedevelopmentenvironment,developasimpleoperation,interfaceaesthetics,thefunctionismorecompletesnakegame.Thewholegameprogramisdividedintotwofunctionmodule,eightclassmodule,realizethegamestobegin,pause,over.Throughthedevelopmentofthegame,tolearnJavatechnologyandfamiliarwiththepurposeofthesoftwaredevelopmentprocess.BasedontheintroductionofJavarelatedtechnologyandthedomesticandforeigndevelopmentpresentsituation,onthebasisofsnakegameofthewholelifecycleofeachdevelopmentphasesareintroducedindetail.Firstofall,analyzesthefeasibilityofthisgamesoftwaredevelopment,thispaperanalyzesthedesignofthefeasibilityofthetechnology.Second,fromthegameinsuchaspectsastheinterface,andanalyzesthefunctionrequirementsofthisgame;Canusesexandsafetyfromanalyzestheattributedemand.Then,thesummaryofgamedesignanddetaileddesign,thisalsoisthefocusofthispaper.Generaldesigngivestwofunctionmodule'smainframeandeightclassmodulefunctioncallrelationship;ThedetaileddesignJava2standardoperationenvironmentisintroducedtheconfiguration,eachmoduleofthekeygivenalistofprograms,ineachkindofvariablecontains,anduseofthemethod,showthegameinterface.Inordertoguaranteethecorrectnessoftheprogramcodeandfunctionoftherealizationofthereliability,thispaperalsointroducesthegamesoftwareprogramdebuggingprocessandfunctiontestresults.KeyWords:Java;Eclipse;Snake;Developmentprocess仰恩大学毕业设计(论文)III目录摘要..................................................................IIAbstract..............................................................II引言...............................................................1第一章系统开发环境....................................................21.1开发工具.....................................................................................................................21.2应用环境.....................................................................................................................2第二章系统需求分析....................................................22.1需求分析.....................................................................................................................22.2可行性分析.................................................................................................................3第三章系统概要设计....................................................33.1设计目标.....................................................................................................................33.2系统功能模块.............................................................................................................33.3系统数据结构设计.....................................................................................................43.3.1蛇、石头、食物的表示................................................................................43.3.2蛇的移动..........................................................................................................53.3.3存储蛇身的数据结构......................................................................................53.3.4蛇的移动方向..................................................................................................53.3.5如何显示蛇身..................................................................................................63.3.6蛇身的移动方向..............................................................................................63.3.7吃到食物判定..................................................................................................6第四章系统详细设计....................................................64.1程序设计.....................................................................................................................64.1.1主类MainFrame..............................................................................................64.1.2类MainFrame..................