CN109954275A - A kind of three-dimensional labyrinth Random Generation - Google Patents
A kind of three-dimensional labyrinth Random Generation Download PDFInfo
- Publication number
- CN109954275A CN109954275A CN201910146035.9A CN201910146035A CN109954275A CN 109954275 A CN109954275 A CN 109954275A CN 201910146035 A CN201910146035 A CN 201910146035A CN 109954275 A CN109954275 A CN 109954275A
- Authority
- CN
- China
- Prior art keywords
- room
- current
- accessed
- visited
- labyrinth
- 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.)
- Granted
Links
Classifications
-
- A—HUMAN NECESSITIES
- A63—SPORTS; GAMES; AMUSEMENTS
- A63F—CARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
- A63F13/00—Video games, i.e. games using an electronically generated display having two or more dimensions
- A63F13/60—Generating 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
Abstract
The present invention relates to a kind of three-dimensional labyrinth Random Generations.Three-dimensional labyrinth of the present invention is the trend for having front, back, left, right, up, down to be total to six direction, the walking being truly realized in a three-dimensional space.And no matter the three-dimensional labyrinth Random Generation proposed in design all makes great progress relative to two-dimentional labyrinth generating algorithm or the method for engineer.Relative to two-dimentional labyrinth, it has higher level, while it also includes two-dimentional labyrinth, if having selected the lowest class;Relative to the method for engineer, it solves artificial cumbersome step, reaches same effect by the calculating of computer.Three-dimensional labyrinth Random Generation is intended to increase the interest of game, and game designer directly can obtain the logical model in labyrinth using this algorithm.Therefore, there is three-dimensional labyrinth Random Generation, game designer need not just be entangled with the design process in labyrinth.
Description
Technical field
The invention belongs to solve the problems, such as a kind of computerized algorithm technical field, it is related to the electricity in three-dimensional labyrinth for certain
Generation scheme in sub- game, in particular to a kind of three-dimensional labyrinth Random Generation.
Background technique
Now many online described three-dimensional labyrinths and two-dimentional labyrinth, are inherently two-dimensional labyrinth in fact, only
The form of expression has the different of two and three dimensions, the only trend of front, rear, left and right four direction, is in one plane
Walking.
Summary of the invention
To solve to appeal technical problem, the invention provides the following technical scheme:
A kind of three-dimensional labyrinth Random Generation, which is characterized in that including
Step 1, using starting point room as the room currently selected;
Step 2, access current room, and current room is labeled as having accessed;
Step 3 will judge whether that there is also the rooms not being accessed after the table tail of current room insertion linear list;
Or
Directly judge whether that there is also the rooms not being accessed;
Step 4 is handled as follows according to selection;
Step 4.1 will judge whether that there is also the rooms not being accessed after the table tail of current room insertion linear list, such as
The room not being accessed is not present in fruit, terminates whole flow process;If there is also the room not being accessed:
Step 4.1.1, a room is randomly choosed from linear list, and this room is set to the room currently selected
Between;
Step 4.1.1.1, judge current room there is also not visited adjacent room, if current room there is also
Not visited adjacent room:
(a) the adjacent room of an also not visited mistake is randomly choosed from current room, and this room is labeled as
It has accessed;
(b) wall among current selection room and this room is removed;
(c) after this room to be inserted into the table tail of linear list, if there is also the adjacent rooms not being accessed in this room
With regard to repeating step 4.1;
Step 4.1.1.2, judging current room, there is also not visited adjacent rooms, if current room is not present
Not visited adjacent room, then delete it from linear list.Not visited room is judged whether there is again, if do not deposited
Then terminate whole flow process in not visited room;Step 4.1.1 is repeated if there is also the room not being accessed.
Step 4.2 directly judges whether there is also the room not being accessed, if there is no not visited room,
Then terminate whole flow process;If not visited according to whether there is in current room there is also the room not being accessed
Adjacent room selects to execute:
Step 4.2.1, if there are not visited adjacent rooms in current room: if
A. it in the adjacent room of all not visited mistakes of current room, randomly chooses a room and marks;
B. the wall between this room and currently selected room is removed;
C. by current room stacking;
D. step 4.2 is repeated after selected room being arranged to the room currently selected;
If not visited adjacent room step 4.2.2, is not present in current room:
A. stack top room is popped
B. step 4.2 is repeated after the room popped being set to the room currently selected.
Three-dimensional labyrinth of the present invention is the trend for having front, back, left, right, up, down to be total to six direction, is really realized
Walking in one three-dimensional space.And no matter the three-dimensional labyrinth Random Generation proposed is relative to two-dimentional labyrinth generating algorithm
Or the method for engineer, all makes great progress in design.Relative to two-dimentional labyrinth, it has higher level,
It also includes two-dimentional labyrinth simultaneously, if having selected the lowest class;Relative to the method for engineer, it solves artificial breeding
Trivial step reaches same effect by the calculating of computer.Three-dimensional labyrinth Random Generation is intended to increase the interest of game
Taste, game designer directly can obtain the logical model in labyrinth using this algorithm.Therefore, three-dimensional labyrinth generates at random
Algorithm, game designer need not just be entangled with the design process in labyrinth.
Detailed description of the invention
Fig. 1 is three-dimensional labyrinth generating algorithm Prim algorithm flow chart.
Fig. 2 is three-dimensional labyrinth generating algorithm backtracking algorithm flow chart.
Specific embodiment
One, Method And Principle of the invention is introduced first.
The present invention mainly realizes the three-dimensional labyrinth of six direction, and (form of expression can be two-dimensional, be also possible to three-dimensional
), relative to two-dimentional labyrinth Random Generation, propose three-dimensional labyrinth generating algorithm.The invention provides the following technical scheme:
1. the three-dimensional labyrinth Random Generation based on backtracking algorithm;
2. the three-dimensional labyrinth Random Generation based on Prim algorithm.
It introduces in detail below.
Recall algorithm:
Backtracking algorithm basic thought be: go ahead from Yi Tiaolu, can into then into, cannot into then retract come, the road Huan Yitiao
It tries again.
Realize this method, the main data structure for needing to use is stack and queue.The effect of stack be store by
The room accessed, the effect of queue are then to play a booster action, facilitate one adjacent room of random selection.
Specific way is:
(1) using starting point room as the room currently selected;
(2) current room is accessed, and current room is labeled as having accessed;
(3) if recycled there is also the room not being accessed:
1. if there are not visited adjacent rooms in current room:
A. it in the adjacent room of all not visited mistakes of current room, randomly chooses a room and marks;
B. the wall between this room and currently selected room is removed;
C. by current room stacking;
D. selected room is arranged to the room currently selected;
2. otherwise:
A. stack top room is popped
B. the room popped is set to the room currently selected;
Prim algorithm:
Specific practice is:
(1) using starting room as the room currently selected;
(2) current room is accessed, and current room is labeled as having accessed;
(3) by the table tail of current room insertion linear list;
(4) if recycled there is also the room not being accessed:
1. randomly choosing a room from linear list;
2. this room to be set to the room currently selected;
A. if current room there is also not visited adjacent rooms:
(a) the adjacent room of an also not visited mistake is randomly choosed from current room, and this room is labeled as
It has accessed;
(b) wall among current selection room and this room is removed;
(c) by the table tail of this room insertion linear list;
B. otherwise: current room is deleted from linear list;
It two, is the concrete case for using the above method below.
The structural body in a labyrinth is defined first:
typedefCell***maze;// maze type is defined, it is in the nature a three-dimensional of Cell structure type
The pointer of array
Then, the stack that can be used in algorithm main body, queue, certain methods used in linear list are provided:
(1) stack:
(2) queue
(3) linear list
Finally, providing the main body algorithm of two kinds of algorithms: (1) recall algorithm:
(2) Prim algorithm:
Specific embodiment described herein is only an example for the spirit of the invention.The neck of technology belonging to the present invention
The technical staff in domain can make various modifications or additions to the described embodiments or replace by a similar method
In generation, however, it does not deviate from the spirit of the invention or beyond the scope of the appended claims.
Claims (1)
1. a kind of three-dimensional labyrinth Random Generation, which is characterized in that including
Step 1, using starting point room as the room currently selected;
Step 2, access current room, and current room is labeled as having accessed;
Step 3 will judge whether that there is also the rooms not being accessed after the table tail of current room insertion linear list;
Or
Directly judge whether that there is also the rooms not being accessed;
Step 4 is handled as follows according to selection;
Step 4.1 will judge whether that there is also the rooms not being accessed after the table tail of current room insertion linear list, if not
In the presence of the room not being accessed, terminate whole flow process;If there is also the room not being accessed:
Step 4.1.1, a room is randomly choosed from linear list, and this room is set to the room currently selected;
Step 4.1.1.1, judge current room there is also not visited adjacent room, if current room there is also not by
The adjacent room of access, then:
(a) the adjacent room of an also not visited mistake is randomly choosed from current room, and this room is labeled as having visited
It asks;
(b) wall among current selection room and this room is removed;
(c) it by after the table tail of this room insertion linear list, is weighed if this room is there is also the adjacent room not being accessed
Multiple step 4.1;
Step 4.1.1.2, judge current room there is also not visited adjacent room, if current room there is no not by
The adjacent room of access, then delete it from linear list;Not visited room is judged whether there is again, if there is no not
Accessed room then terminates whole flow process;Step 4.1.1 is repeated if there is also the room not being accessed;
Step 4.2 directly judges whether if there is no not visited room, then to tie there is also the room not being accessed
Beam whole flow process;If there is also the room not being accessed, according in current room with the presence or absence of not visited adjacent
Room select execute:
Step 4.2.1, if there are not visited adjacent rooms in current room: if
A. it in the adjacent room of all not visited mistakes of current room, randomly chooses a room and marks;
B. the wall between this room and currently selected room is removed;
C. by current room stacking;
D. step 4.2 is repeated after selected room being arranged to the room currently selected;
If not visited adjacent room step 4.2.2, is not present in current room:
A. stack top room is popped
B. step 4.2 is repeated after the room popped being set to the room currently selected.
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 true CN109954275A (en) | 2019-07-02 |
CN109954275B 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) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111494958A (en) * | 2020-04-20 | 2020-08-07 | 张洋 | Method and device for randomly generating maze map |
Citations (5)
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 |
-
2019
- 2019-02-27 CN CN201910146035.9A patent/CN109954275B/en active Active
Patent Citations (5)
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)
Title |
---|
杜 凯: "基于图的深度遍历产生随机迷宫的算法研究", 《黄冈师范学院学报》 * |
王康: "三维迷宫的设计与建模", 《浙江大学学报(理学版)》 * |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111494958A (en) * | 2020-04-20 | 2020-08-07 | 张洋 | Method and device for randomly generating maze map |
CN111494958B (en) * | 2020-04-20 | 2023-06-16 | 张洋 | Method and device for randomly generating maze map |
Also Published As
Publication number | Publication date |
---|---|
CN109954275B (en) | 2022-10-21 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103310480B (en) | By the method and apparatus using replaceable rejecting program to improve graphics performance | |
CN103279980A (en) | Tree leaf modeling method based on point cloud data | |
Han et al. | Effective hybrid discrete artificial bee colony algorithms for the total flowtime minimization in the blocking flowshop problem | |
CN104054112A (en) | Drawing data generation device and image drawing device | |
CN107126702B (en) | Generation method of 3D game random map | |
CN104504468B (en) | Three-dimensional packing method based on three-dimensional Move Mode sequence Yu close female algorithm | |
Guo et al. | Creature grammar for creative modeling of 3D monsters | |
CN107169983A (en) | Multi-threshold image segmentation method based on cross and variation artificial fish-swarm algorithm | |
CN109448795A (en) | The recognition methods of circRNA a kind of and device | |
CN104751507A (en) | Method and device for rendering pattern contents | |
CN105874511B (en) | Analog machine | |
CN109954275A (en) | A kind of three-dimensional labyrinth Random Generation | |
CN104574275B (en) | A kind of method for merging textures during modeling rendering | |
US6766497B2 (en) | Method and system for reproduction in a genetic optimization process | |
JP6973137B2 (en) | Generation program, generation method and generation device | |
CN102339473A (en) | Genetic algorithm-based method for design of cartoon model | |
CN106202247B (en) | A kind of collision checking method based on longitude and latitude | |
Cazenave | Nested monte-carlo expression discovery | |
CN103247077A (en) | 3D (three dimensional) model edge collapse simplification method based on multi-vertex pair treatment | |
CN107153776A (en) | A kind of mono- times of group's detection method of Y | |
Safak et al. | Automated maze generation for Ms. Pac-Man using genetic algorithms | |
CN106898037A (en) | A kind of Animation of Fish Shoal manufacturing system and its shoal of fish generation method | |
CN110772794B (en) | Intelligent game processing method, device, equipment and storage medium | |
CN107945273A (en) | Treating method and apparatus, storage medium and the terminal of terrain mesh | |
CN105703359B (en) | Application of symmetric sparse factor table method in load flow calculation of rectangular coordinate PQ decomposition method |
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 |