CN109954275B - Three-dimensional maze random generation system - Google Patents

Three-dimensional maze random generation system Download PDF

Info

Publication number
CN109954275B
CN109954275B CN201910146035.9A CN201910146035A CN109954275B CN 109954275 B CN109954275 B CN 109954275B CN 201910146035 A CN201910146035 A CN 201910146035A CN 109954275 B CN109954275 B CN 109954275B
Authority
CN
China
Prior art keywords
room
accessed
current
adjacent
judging whether
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910146035.9A
Other languages
Chinese (zh)
Other versions
CN109954275A (en
Inventor
吴志红
易文驰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huanggang Normal University
Original Assignee
Huanggang Normal University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huanggang Normal University filed Critical Huanggang Normal University
Priority to CN201910146035.9A priority Critical patent/CN109954275B/en
Publication of CN109954275A publication Critical patent/CN109954275A/en
Application granted granted Critical
Publication of CN109954275B publication Critical patent/CN109954275B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/60Generating or modifying game content before or while executing the game program, e.g. authoring tools specially adapted for game development or game-integrated level editor

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Processing Or Creating Images (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The invention relates to a three-dimensional maze random generation algorithm. The three-dimensional maze has the trend of six directions including front, back, left, right, up and down, and really realizes the walking in a three-dimensional space. The proposed three-dimensional maze random generation algorithm is greatly improved in design compared with a two-dimensional maze generation algorithm and a manual design method. It has a higher hierarchy than the two-dimensional maze, and it also includes the two-dimensional maze if the lowest level is selected; compared with a manual design method, the method solves the problem of complicated manual steps, and achieves the same effect through the calculation of a computer. The three-dimensional maze random generation algorithm aims at increasing the interestingness of the game, and a game designer can directly apply the algorithm to obtain a logic model of the maze. Therefore, with the three-dimensional maze random generation algorithm, the game designer does not need to tangle the design process of the maze.

Description

Three-dimensional maze random generation system
Technical Field
The invention belongs to the technical field of computer algorithms for solving a class of problems, and particularly relates to a three-dimensional maze random generation system aiming at certain generation schemes in electronic games relating to three-dimensional labyrinths.
Background
At present, the three-dimensional maze and the two-dimensional maze are essentially two-dimensional maze, but the expression forms are different from two-dimensional and three-dimensional, and only the trend in the front, back, left and right directions is walking on a plane.
Disclosure of Invention
In order to solve the technical problem of the complaint, the invention provides the following technical scheme:
a three-dimensional maze random generation system applied to an electronic game of a three-dimensional maze is characterized by comprising
A room selection module: taking the starting room as a currently selected room;
an editing module: accessing the current room and marking the current room as accessed;
a judging module: inserting the current room into the tail of the linear table and then judging whether a room which is not accessed exists or not;
or
Directly judging whether rooms which are not accessed exist or not;
a processing module: according to the selection, the following treatment is carried out;
after inserting the current room into the tail of the linear table, judging whether a room which is not accessed exists, if not, ending the whole process; if there are no more rooms to be visited:
randomly selecting a room from the linear table and setting the room as the currently selected room;
judging that the current room has an adjacent room which is not accessed, if the current room has an adjacent room which is not accessed, then:
(a) Randomly selecting one adjacent room which is not visited yet from the current rooms, and marking the room as visited;
(b) Removing the currently selected room and a wall in the middle of the room;
(c) After inserting the room into the table tail of the linear table, if the room has an adjacent room which is not accessed, repeatedly inserting the current room into the table tail of the linear table and then judging whether the room which is not accessed exists;
judging whether an unvisited adjacent room exists in the current room, and if the unvisited adjacent room does not exist in the current room, deleting the unvisited adjacent room from the linear table; judging whether an unvisited room exists or not, and if the unvisited room does not exist, ending the whole process; if the room which is not accessed exists, randomly selecting a room from the linear table repeatedly, and setting the room as the currently selected room;
directly judging whether a room which is not accessed exists or not, and if the room which is not accessed does not exist, finishing the whole process; if the room which is not accessed exists, selecting to execute according to whether the adjacent room which is not accessed exists in the current room:
if there are neighboring rooms in the current room that have not been accessed: then the
a. Randomly selecting and marking one room from all unvisited adjacent rooms of the current room;
b. removing the wall between the room and the currently selected room;
c. stacking the current room;
d. setting the selected room as the currently selected room, and then repeatedly and directly judging whether a room which is not accessed exists or not;
if there is no neighboring room in the current room that has not been accessed:
a. top room out of stack
b. And setting the popped room as the currently selected room, and then repeatedly and directly judging whether rooms which are not accessed exist.
The three-dimensional maze has the trend of six directions including front, back, left, right, up and down, and really realizes the walking in a three-dimensional space. The proposed three-dimensional maze random generation algorithm is greatly improved in design compared with a two-dimensional maze generation algorithm and a manual design method. It has a higher hierarchy than the two-dimensional maze, and it also includes the two-dimensional maze if the lowest level is selected; compared with a manual design method, the method solves the problem of complicated manual steps, and achieves the same effect through the calculation of a computer. The three-dimensional maze random generation algorithm aims at increasing the interestingness of the game, and a game designer can directly apply the algorithm to obtain a logic model of the maze. Therefore, with the three-dimensional maze random generation algorithm, the game designer does not need to tangle the design process of the maze.
Drawings
FIG. 1 is a flow chart of the three-dimensional maze generation algorithm Prim algorithm.
FIG. 2 is a flowchart of a three-dimensional maze generation algorithm backtracking algorithm.
Detailed Description
1. The principle of the method of the present invention is first described.
The invention mainly realizes the three-dimensional maze in six directions (the expression form can be two-dimensional or three-dimensional), and provides a three-dimensional maze generation algorithm relative to a two-dimensional maze random generation algorithm. The invention provides the following technical scheme:
1. a three-dimensional maze random generation algorithm based on a backtracking algorithm;
2. and (3) a three-dimensional maze random generation algorithm based on Prim algorithm.
As described in detail below.
The backtracking algorithm comprises the following steps:
the basic idea of the backtracking algorithm is as follows: and moving forward from one path, advancing if the vehicle can advance, retreating if the vehicle cannot advance, and changing one path to try again.
The main data structures required to implement this approach are stacks and queues. The stack is used for storing accessed rooms, and the queue is used for assisting in randomly selecting an adjacent room.
The specific method comprises the following steps:
(1) Taking the starting room as the currently selected room;
(2) Accessing the current room and marking the current room as accessed;
(3) If there are no more rooms to be visited, loop:
(1) if there are neighboring rooms in the current room that have not been accessed:
a. randomly selecting and marking one room from all unvisited adjacent rooms of the current room;
b. removing the wall between the room and the currently selected room;
c. stacking the current room;
d. setting the selected room as a currently selected room;
(2) otherwise:
a. top room out of stack
b. Setting the popped room as the currently selected room;
prim algorithm:
the specific method comprises the following steps:
(1) Taking the starting room as the currently selected room;
(2) Accessing the current room and marking the current room as accessed;
(3) Inserting the current room into the tail of the linear table;
(4) If there are no more rooms to be visited, loop:
(1) randomly selecting a room from the linear table;
(2) setting the room as a currently selected room;
a. if the current room has an adjacent room that has not been accessed:
(a) Randomly selecting one adjacent room which is not visited yet from the current rooms, and marking the room as visited;
(b) Removing the currently selected room and a wall in the middle of the room;
(c) Inserting the room into the tail of the linear meter;
b. otherwise: deleting the current room from the linear table;
2. the following is a specific case of using the above method.
First, a labyrinth structure is defined:
Figure GDA0003839736940000041
then, some methods used by stacks, queues, linear tables that will be used in the body of the algorithm are given:
(1) Stacking:
Figure GDA0003839736940000042
Figure GDA0003839736940000051
(2) Queue
Figure GDA0003839736940000052
Figure GDA0003839736940000061
(3) Linear meter
Figure GDA0003839736940000062
Figure GDA0003839736940000071
Figure GDA0003839736940000081
Finally, the subject algorithm of two algorithms is given:
(1) The backtracking algorithm comprises the following steps:
Figure GDA0003839736940000082
Figure GDA0003839736940000091
Figure GDA0003839736940000101
Figure GDA0003839736940000111
Figure GDA0003839736940000121
Figure GDA0003839736940000131
(2) Prim algorithm:
Figure GDA0003839736940000132
Figure GDA0003839736940000141
Figure GDA0003839736940000151
Figure GDA0003839736940000161
Figure GDA0003839736940000171
Figure GDA0003839736940000181
the specific embodiments described herein are merely illustrative of the spirit of the invention. Various modifications or additions may be made to the described embodiments, or alternatives may be employed, by those skilled in the art, without departing from the spirit or ambit of the invention as defined in the appended claims.

Claims (1)

1. A three-dimensional maze random generation system is characterized by comprising
A room selection module: taking the starting room as the currently selected room;
an editing module: accessing the current room and marking the current room as accessed;
a judging module: inserting the current room into the tail of the linear table and then judging whether a room which is not accessed exists or not;
or
Directly judging whether rooms which are not accessed exist or not;
a processing module: according to the selection, the following treatment is carried out;
inserting the current room into the tail end of the linear table, judging whether a room which is not accessed exists or not, and if the room which is not accessed does not exist, finishing the whole process; if there are no more rooms to be visited:
randomly selecting a room from the linear table, and setting the room as the currently selected room;
judging that the current room has an adjacent room which is not accessed, if the current room has an adjacent room which is not accessed, then:
(a) Randomly selecting one adjacent room which is not visited yet from the current rooms, and marking the room as visited;
(b) Removing the currently selected room and a wall in the middle of the room;
(c) After inserting the room into the table tail of the linear table, if the room has an adjacent room which is not accessed, repeatedly inserting the current room into the table tail of the linear table and then judging whether the room which is not accessed exists;
judging whether an unvisited adjacent room exists in the current room, and if the unvisited adjacent room does not exist in the current room, deleting the unvisited adjacent room from the linear table; judging whether an unvisited room exists or not, and if the unvisited room does not exist, ending the whole process; if the room which is not accessed exists, randomly selecting a room from the linear table repeatedly, and setting the room as the currently selected room;
directly judging whether a room which is not accessed exists or not, and if the room which is not accessed does not exist, finishing the whole process; if the room which is not accessed exists, selecting to execute according to whether the adjacent room which is not accessed exists in the current room:
if there are neighboring rooms in the current room that have not been accessed: then
a. Randomly selecting and marking one room from all adjacent rooms which are not visited in the current room;
b. removing the wall between the room and the currently selected room;
c. stacking the current room;
d. setting the selected room as the currently selected room, and then repeatedly and directly judging whether a room which is not accessed exists or not;
if no neighboring room is not visited in the current room:
a. top room out of stack
b. And setting the popped room as the currently selected room, and then repeatedly and directly judging whether rooms which are not accessed exist.
CN201910146035.9A 2019-02-27 2019-02-27 Three-dimensional maze random generation system Active CN109954275B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910146035.9A CN109954275B (en) 2019-02-27 2019-02-27 Three-dimensional maze random generation system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910146035.9A CN109954275B (en) 2019-02-27 2019-02-27 Three-dimensional maze random generation system

Publications (2)

Publication Number Publication Date
CN109954275A CN109954275A (en) 2019-07-02
CN109954275B true CN109954275B (en) 2022-10-21

Family

ID=67023912

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910146035.9A Active CN109954275B (en) 2019-02-27 2019-02-27 Three-dimensional maze random generation system

Country Status (1)

Country Link
CN (1) CN109954275B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111494958B (en) * 2020-04-20 2023-06-16 张洋 Method and device for randomly generating maze map

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN203244749U (en) * 2013-04-16 2013-10-23 陈顺达 Multi-directional intelligence labyrinth
US8600707B1 (en) * 2011-03-24 2013-12-03 Florida Turbine Technologies, Inc. Process for analyzing a labyrinth seal for flutter
CN104809309A (en) * 2015-05-14 2015-07-29 北京理工大学 Three-dimensional automatic wiring method and device based on rapidly-exploring random tree
CN105597316A (en) * 2015-12-22 2016-05-25 珠海金山网络游戏科技有限公司 Method, system and device for generating random maze scene based on matched table
CN108108410A (en) * 2017-12-12 2018-06-01 苏州蜗牛数字科技股份有限公司 A kind of online game labyrinth ground drawing generating method

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8600707B1 (en) * 2011-03-24 2013-12-03 Florida Turbine Technologies, Inc. Process for analyzing a labyrinth seal for flutter
CN203244749U (en) * 2013-04-16 2013-10-23 陈顺达 Multi-directional intelligence labyrinth
CN104809309A (en) * 2015-05-14 2015-07-29 北京理工大学 Three-dimensional automatic wiring method and device based on rapidly-exploring random tree
CN105597316A (en) * 2015-12-22 2016-05-25 珠海金山网络游戏科技有限公司 Method, system and device for generating random maze scene based on matched table
CN108108410A (en) * 2017-12-12 2018-06-01 苏州蜗牛数字科技股份有限公司 A kind of online game labyrinth ground drawing generating method

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
三维迷宫的设计与建模;王康;《浙江大学学报(理学版)》;20170331;第44卷(第2期);全文 *
基于图的深度遍历产生随机迷宫的算法研究;杜 凯;《黄冈师范学院学报》;20080615;全文 *

Also Published As

Publication number Publication date
CN109954275A (en) 2019-07-02

Similar Documents

Publication Publication Date Title
CN106296785A (en) A kind of picture rendering intent and picture rendering apparatus
CN107209853B (en) Positioning and map construction method
WO2019085709A1 (en) Pooling method and system applied to convolutional neural network
Abraham et al. Particle swarm optimisation based Diophantine equation solver
CN112887437A (en) Block chain transaction processing method, block chain node and block chain
CN103617226B (en) A kind of matching regular expressions method and device
US20180307787A1 (en) Accelerating particle-swarm algorithms
CN105511806B (en) The method and mobile terminal of processing write requests
CN109954275B (en) Three-dimensional maze random generation system
CN105183623B (en) A kind of method and apparatus that VDG reconstruction performance is improved based on hot standby VD
JP2022173186A (en) Data flood checking and improved performance of gaming processes
CN106469186A (en) A kind of method and device of character string comparison
CN106776466A (en) A kind of FPGA isomeries speed-up computation apparatus and system
CN110351397A (en) A kind of method and device matching IP network section
US10719982B2 (en) Surface extrction method, apparatus, and non-transitory computer readable storage medium thereof
CN106874789A (en) Method for secret protection and system that a kind of identity-based is substituted
CN103500108B (en) Installed System Memory access method, Node Controller and multicomputer system
US11567661B2 (en) Virtual memory management method and processor
Brown et al. Baby Tartanian8: Winning Agent from the 2016 Annual Computer Poker Competition.
CN104050189B (en) The page shares processing method and processing device
US11511191B2 (en) Interactive control system and method for game objects, server and computer-readable storage medium
US20190042662A1 (en) Techniques for information graph compression
CN109844774A (en) A kind of parallel deconvolution calculation method, single engine calculation method and Related product
TW202118545A (en) Method for providing battle royale game in which game area and number of participants are determined dynamically and the server using the same
CN104504469A (en) Box loading method based on three-dimensional moving mode sequence and multi-intelligent-agent genetic algorithm

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant