齐齐哈尔大学学报(自然科学版)
齊齊哈爾大學學報(自然科學版)
제제합이대학학보(자연과학판)
JOURNAL OF QIQIHAR UNIVERSITY(NATURAL SCIENCE EDITION)
2014年
1期
1-5,24
,共6页
迷宫游戏%深度优先遍历%算法设计%回溯法
迷宮遊戲%深度優先遍歷%算法設計%迴溯法
미궁유희%심도우선편력%산법설계%회소법
maze game%depth-first traversal%algorithm design%backtracking method
在Eclipse平台上,选择Java语言完成迷宫游戏的设计与开发。采用随机布点算法生成不规则迷宫地图,采用图的深度优先遍历算法随机生成规则地图。在相同的窗口,运用地图格的大小不同来生成较低、中等、较高三种不同难度的规则或不规则地图。把走迷宫的对象设置成角色方块,使用键盘的方向键控制当前移动点进行游戏。按照遍历规则地图的起点不同,把游戏分简单,中等,高难三种难易程度。运用回溯法从入口一步步进行探索,最后找到迷宫出口,并在界面上显示出该路径。编写画布类函数Canvas()实现游戏设置。游戏的成功开发表明,算法研究至关重要,应用这些算法开发游戏是有效的。
在Eclipse平檯上,選擇Java語言完成迷宮遊戲的設計與開髮。採用隨機佈點算法生成不規則迷宮地圖,採用圖的深度優先遍歷算法隨機生成規則地圖。在相同的窗口,運用地圖格的大小不同來生成較低、中等、較高三種不同難度的規則或不規則地圖。把走迷宮的對象設置成角色方塊,使用鍵盤的方嚮鍵控製噹前移動點進行遊戲。按照遍歷規則地圖的起點不同,把遊戲分簡單,中等,高難三種難易程度。運用迴溯法從入口一步步進行探索,最後找到迷宮齣口,併在界麵上顯示齣該路徑。編寫畫佈類函數Canvas()實現遊戲設置。遊戲的成功開髮錶明,算法研究至關重要,應用這些算法開髮遊戲是有效的。
재Eclipse평태상,선택Java어언완성미궁유희적설계여개발。채용수궤포점산법생성불규칙미궁지도,채용도적심도우선편력산법수궤생성규칙지도。재상동적창구,운용지도격적대소불동래생성교저、중등、교고삼충불동난도적규칙혹불규칙지도。파주미궁적대상설치성각색방괴,사용건반적방향건공제당전이동점진행유희。안조편력규칙지도적기점불동,파유희분간단,중등,고난삼충난역정도。운용회소법종입구일보보진행탐색,최후조도미궁출구,병재계면상현시출해로경。편사화포류함수Canvas()실현유희설치。유희적성공개발표명,산법연구지관중요,응용저사산법개발유희시유효적。
The paper designed and developed a Maze game under the Eclipse platform by using Java development tool. The random distributed point algorithm is used to generate an irregular map, and the algorithm of depth-first traveling is used to generate a regular map. Setting different size of the map’s grid in the map on the same game window forms three kinds of degree of difficulty which are low, medium, and high. Set the game walker as a role object, use the keyboard’s arrow keys to control the current point move, and we can play the game. From different point to travel form three level games on regular map which are simple, medium, and difficulty. Take backtracking method to search the path from entrance to the exit step by step, find it at last, and show the path on the interface. Program the function Canvas() to set the game configurations. The result of successful development of the Maze game shows that algorithms are important and using them to develop the game is effective.