Maze generation method, device, electronic device and storage medium

By adjusting the position status in the maze to respond to changes in user positions, the problem of the existing maze route being fixed is solved, and a maze with high variability is generated, which improves the fun and user experience of the maze.

CN114618164BActive Publication Date: 2025-02-28HANGZHOU QULIAN TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210188544.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-28
Publication Date
2025-02-28
Estimated Expiration
2042-02-28

AI Technical Summary

Technical Problem

The route of the existing maze remains unchanged, resulting in poor fun in the maze.

Method used

By adjusting the state of each position in the maze based on the user's position, a maze that changes with the user's position is generated. The method includes obtaining the maze information contract, initializing the pending queue, adjusting the position state in the queue according to the user's position, and generating the maze according to the adjusted state.

Benefits of technology

It realizes the generation of a maze with high variability, enhances the fun of the maze, and makes the user experience more diverse and dynamic.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure HDA0003524602100000011
    Figure HDA0003524602100000011
  • Figure HDA0003524602100000012
    Figure HDA0003524602100000012
  • Figure HDA0003524602100000013
    Figure HDA0003524602100000013
Patent Text Reader

Abstract

The present application relates to a maze generation method, device, electronic device and storage medium, the maze generation method comprising: adjusting the state of each position in the maze based on the user's position to obtain the adjusted state of each position in the maze; the state is used to represent the entrance, exit, road and obstacle of the maze; based on the adjusted state of each position in the maze, the maze is generated. In the present application, the state of each position in the maze is adjusted according to the user's position, and based on the adjusted state of each position in the maze, a maze with high variability generated according to the user's position is obtained.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of blockchain technology, and in particular to a maze generation method, device, electronic device and storage medium. Background Art

[0002] As a relatively common game, the route of the maze in the prior art is generally fixed, that is, the entrance, road, obstacles (such as "walls") and exit of the maze are fixed. After completing a level once, the user can complete the level multiple times by memory, or complete the level with the guidance of others if he fails to complete the level. The maze is less interesting. Summary of the invention

[0003] The present application provides a maze generation method, device, electronic device and storage medium to solve the problem that the maze is less interesting due to the fixed route of the maze.

[0004] In a first aspect, the present application provides a maze generation method, the maze generation method comprising:

[0005] Adjusting the state of each position in the maze based on the user's position to obtain the adjusted state of each position in the maze; the state is used to represent the entrance, exit, road and obstacle of the maze;

[0006] A maze is generated based on the states of each position in the adjusted maze.

[0007] Optionally, before adjusting the state of each position in the maze based on the user position to obtain the adjusted state of each position in the maze, the method further includes:

[0008] Get a maze information contract, which is used to store the user's location, the number of steps the user has taken in the maze, and the status of each location in the maze.

[0009] Optionally,

[0010] Before adjusting the state of each position in the maze based on the user position to obtain the adjusted state of each position in the maze, the method further includes:

[0011] If the number of steps taken by the user in the maze is 0, the state of each position in the maze is initialized to obtain the initialization state of each position in the maze, and the step of adjusting the state of each position in the maze based on the user's position to obtain the adjusted state of each position in the maze is executed.

[0012] Optionally, the state of each position in the maze is adjusted based on the user position to obtain the adjusted state of each position in the maze, including:

[0013] The positions in the queue to be processed are initialized according to the user position, and the states of the positions in the queue to be processed are adjusted according to the states of the positions in the maze to obtain the adjusted states of the positions in the maze.

[0014] Optionally, the position in the queue to be processed is initialized according to the user position, including:

[0015] Determine adjacent peripheral positions of the user position in the maze, and select a position that has not entered the queue to be processed from the adjacent peripheral positions as a target position;

[0016] Initialize the position in the queue to be processed as the target position.

[0017] Optionally, adjusting the status of the positions in the queue to be processed according to the status of each position in the maze includes:

[0018] Perform the following operations on any position in the queue to be processed, and remove the any position from the queue to be processed, until a random number of the any positions are removed from the queue to be processed:

[0019] If the state of any position is the exit, entrance or road of the maze, the state of any position is kept unchanged;

[0020] If the state of any of the positions is an obstacle of the maze, the state of any of the positions is adjusted.

[0021] Optionally, the random number is determined using the global state of the blockchain as a seed.

[0022] Optionally, the adjusting the state of any one of the positions includes:

[0023] If there is no position in the maze that is the exit of the maze, then the state of any position is adjusted from an obstacle of the maze to the exit of the maze with a preset probability, or the state of any position is adjusted from an obstacle of the maze to a path of the maze;

[0024] If there is a position in the maze whose state is the exit of the maze, the state of any position is adjusted from an obstacle of the maze to a path of the maze.

[0025] Optionally, after adjusting the state of any one of the positions, the method further includes:

[0026] If the state of any position changes from an obstacle in the maze to a path in the maze, the position in the queue to be processed is adjusted.

[0027] Optionally, adjusting the position in the queue to be processed includes:

[0028] The position of the obstacle in the maze among the adjacent positions of the adjacent peripheral positions of the any position in the maze is used as a new target position;

[0029] The new target position is added to the queue to be processed.

[0030] Optionally, the method further comprises:

[0031] If all positions in the maze have entered the queue to be processed, and there is no position in the maze whose status is the exit of the maze, the status of the last position removed from the queue to be processed is adjusted to the exit of the maze.

[0032] In a second aspect, the present application provides a maze generating device, the maze generating device comprising:

[0033] An adjustment module, used to adjust the state of each position in the maze based on the user's position, and obtain the adjusted state of each position in the maze; the state is used to represent the entrance, exit, road and obstacle of the maze;

[0034] The generation module is used to generate a maze based on the states of each position in the adjusted maze.

[0035] In a third aspect, the present application provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other via the communication bus;

[0036] Memory, used to store computer programs;

[0037] The processor is used to implement the steps of the maze generation method described in any embodiment of the first aspect when executing the program stored in the memory.

[0038] In a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the maze generation method as described in any embodiment of the first aspect are implemented.

[0039] The above technical solution provided by the embodiment of the present application has the following advantages compared with the prior art:

[0040] In the maze generation method provided in the embodiment of the present application, the state of each position in the maze is adjusted according to the user's position, and based on the state of each position in the adjusted maze, a maze with high variability generated according to the user's position is obtained. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0042] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0043] Figure 1 A schematic diagram of a maze generation method provided in an embodiment of the present application;

[0044] Figure 2 A schematic diagram of a maze position provided in an embodiment of the present application;

[0045] Figure 3 A schematic diagram of the various positions in a maze provided in an embodiment of the present application Figure 1 ;

[0046] Figure 4 A schematic diagram of the various positions in a maze provided in an embodiment of the present application Figure 2 ;

[0047] Figure 5 A schematic diagram of the various positions in a maze provided in an embodiment of the present application Figure 3 ;

[0048] Figure 6 A schematic diagram of the various positions in a maze provided in an embodiment of the present application Figure 4 ;

[0049] Figure 7 A schematic diagram of a maze provided in an embodiment of the present application;

[0050] Figure 8 A schematic diagram of a maze generating device provided in an embodiment of the present application;

[0051] Fig. 9 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0052] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0053] In order to solve the problem that the maze is less interesting due to the fixed route of the maze, the embodiment of the present application provides a maze generation method, which is applied to a processor, and the processor can be located in any device. Figure 1 As shown, the maze generation method includes steps 101 and 102:

[0054] Step 101: adjusting the state of each position in the maze based on the user's position to obtain the adjusted state of each position in the maze.

[0055] Among them, the state is used to represent the entrance, exit, road and obstacles of the maze.

[0056] Exemplarily, taking position 1 to position 5 in a maze as an example, the states of position 1 and position 2 are the roads of the maze, the state of position 3 is the entrance of the maze, the state of position 4 is the obstacle of the maze, and the state of position 5 is the exit of the maze.

[0057] Optionally, since the user position may change as the user moves, the state of each position in the maze is adjusted as the user position changes, to obtain the adjusted state of each position in the maze.

[0058] Exemplarily, after obtaining the user position as position 1, the states of positions 1-3 in the maze are adjusted based on position 1. Subsequently, the changed user position, i.e., position 2, is obtained, and the states of positions 4-6 in the maze are adjusted based on position 2.

[0059] In this embodiment, a two-dimensional maze is taken as an example to introduce the method of generating a maze in this application. At this time, each position in the maze can be represented by (i, j).

[0060] In a possible implementation, before adjusting the status of each position in the maze based on the user's position, it is necessary to first obtain the user's position, the number of steps the user has walked in the maze, and the status of each position in the maze.

[0061] Specifically, a maze information contract is obtained. The maze information contract is used to store the user's location, the number of steps the user has taken in the maze, and the status of each location in the maze. It should be noted that a contract is a way to store information on a blockchain.

[0062] For example, the maze information contract includes the user position state, the number of steps the user has walked in the maze user, and the state mat of the position (i, j) in the maze i,j .

[0063] At this time, after obtaining the maze information contract, the state of each position in the maze can be adjusted according to the user position in the maze information contract that changes with the user's movement, and the adjusted state of each position in the maze is obtained.

[0064] Optionally, before adjusting the state of each position in the maze based on the user's position to obtain the adjusted state of each position in the maze, it is first determined whether the number of steps the user has walked in the maze is 0 to determine whether to initialize the state of each position in the maze.

[0065] In one possible implementation, if the number of steps taken by the user in the maze is 0, the state of each position in the maze is initialized to obtain the initialization state of each position in the maze, and then the state of each position in the maze is adjusted based on the user's position to obtain the adjusted state of each position in the maze.

[0066] Correspondingly, if the number of steps taken by the user in the maze is 0, the step of directly adjusting the state of each position in the maze based on the user's position to obtain the adjusted state of each position in the maze is executed.

[0067] When the number of steps taken by the user in the maze is 0, it means that the user has just entered the maze. At this time, the state of each position in the maze is uncertain. Therefore, the state of each position in the maze is initialized.

[0068] Generally, when initializing the states of various positions in a maze, the state of the user's position in the maze is initialized to the entrance of the maze, that is, the initialization state of the user's position is the entrance of the maze, and the states of all positions in the maze except the user's position are initialized to obstacles in the maze, that is, the initialization state of all positions in the maze except the user's position is obstacles in the maze.

[0069] Exemplarily, a maze information contract is obtained, which stores the user position (1, 1), the number of steps the user has walked in the maze 0, and the status of each position in the maze. At this time, the status of each position in the maze is initialized to obtain the initialization status of each position in the maze, where the initialization status of position (1, 1) is the entrance of the maze, and the initialization status of all other positions in the maze except position (1, 1) is the obstacle of the maze.

[0070] In one possible implementation, the status of each position in the maze is adjusted based on the user position. In the process of obtaining the status of each position in the adjusted maze, the position in the queue to be processed is initialized according to the user position, and according to the status of each position in the maze, the position in the queue to be processed and the status of the position in the queue to be processed are adjusted to obtain the status of each position in the adjusted maze.

[0071] Specifically, in the process of initializing the position in the queue to be processed according to the user position, the adjacent peripheral positions of the user position in the maze are first determined, and a position that has not entered the queue to be processed is selected from the adjacent peripheral positions as the target position. Subsequently, the position in the queue to be processed is initialized as the target position.

[0072] Exemplarily, the user position is (i, j), and the number of steps the user walks in the maze is 1. First, the adjacent peripheral positions of the user position (i, j) in the maze are determined to include position (i+1, j), position (i-1, j), position (i, j+1) and position (i, j-1). Among them, the state of position (i+1, j) is the entrance of the maze, and the states of position (i-1, j), position (i, j+1) and position (i, j-1) are all obstacles in the maze. These four positions are determined as target positions, and the positions in the queue to be processed are initialized to these four positions. At this time, the queue to be processed after initialization includes position (i+1, j), position (i-1, j), position (i, j+1) and position (i, j-1).

[0073] Exemplarily, in the previous example, if the position (i, j-1) exceeds the boundary of the maze, the adjacent peripheral positions of the user position (i, j) in the maze include the position (i+1, j), the position (i-1, j) and the position (i, j+1). At this time, the position (i+1, j), the position (i-1, j) and the position (i, j+1) are determined as the target positions, and the positions in the queue to be processed are initialized to these three target positions. At this time, the initialized queue to be processed includes the position (i+1, j), the position (i-1, j) and the position (i, j+1).

[0074] For example, in the previous example, if the position (i, j+1) has entered the position of the queue to be processed, the position (i+1, j) and the position (i-1, j) are determined as the target positions, and the positions in the queue to be processed are initialized to the two target positions. At this time, the initialized queue to be processed includes the position (i+1, j) and the position (i-1, j).

[0075] It should be noted that selecting the target position from the adjacent surrounding positions of the user position in the maze can ensure that after the queue to be processed is initialized, the positions in the queue do not exceed the boundary of the maze, ensuring that the positions in the queue to be processed are all positions in the maze, thereby only adjusting the status of the positions in the maze.

[0076] Specifically, in the process of adjusting the position in the queue to be processed and the state of the position in the queue to be processed according to the state of each position in the maze, the following operations are performed on any position in the queue to be processed, and the any position is removed from the queue to be processed until a random number of any positions are removed from the queue to be processed: if the state of any position is the exit, entrance or road of the maze, the state of the any position is kept unchanged; if the state of any position is an obstacle in the maze, the state of the any position and the position in the queue to be processed are adjusted.

[0077] Exemplarily, taking the random number being 2 as an example, the queue to be processed includes 3 positions, including position 1, position 2, and position 3. Determine any position in the queue to be processed, such as position 1, and the state of position 1 is the entrance to the maze, then keep the state of position 1 unchanged, and remove position 1 from the queue to be processed. At this time, the number of any positions removed from the queue to be processed is 1. Subsequently, determine any position in the queue to be processed, such as position 3, and the state of position 3 is an obstacle in the maze, then adjust the state of position 3 and the position in the queue to be processed, and remove position 3 from the queue to be processed. At this time, the number of any positions removed from the queue to be processed is 2. Since the random number is 2, the state of the position in the queue to be processed is no longer adjusted.

[0078] The random number may be determined using the global state of the blockchain as a seed. The global state of the blockchain can also be referred to as the world state of the blockchain, and the global state is a hash value in the blockchain. For example, for a blockchain with a chain structure, the hash value of the latest block, i.e., the last transaction, is used as the world state of the blockchain.

[0079] It should be noted that by using the global state of the blockchain as a seed to determine the random number, the state of the random number positions in the processing queue can be adjusted, making the process of adjusting the state of each position in the maze variable, thereby enhancing the fun of the maze.

[0080] In addition, when adjusting the state of any position, if there is no position in the maze whose state is the exit of the maze, the state of any position is adjusted from an obstacle in the maze to the exit of the maze with a preset probability, or the state of any position is adjusted from an obstacle in the maze to a path in the maze.

[0081] That is, when adjusting the state of any position, if there is no position in the maze that is the exit of the maze, the state of the any position is first adjusted from the obstacle of the maze to the exit of the maze with a preset probability. At this time, if the state of the any position is successfully adjusted from the obstacle of the maze to the exit of the maze, subsequent processing is performed. If the state of the any position is not successfully adjusted from the obstacle of the maze to the exit of the maze, the state of the any position is adjusted from the obstacle of the maze to the path of the maze.

[0082] Correspondingly, if there is a position in the maze whose state is the exit of the maze, the state of any position is directly adjusted to the path of the maze.

[0083] In the process of adjusting the state of any position, if the state of any position is adjusted from an obstacle of the maze to a path of the maze, then after the adjustment, the position in the queue to be processed is adjusted.

[0084] Specifically, in the process of adjusting the positions in the queue to be processed, for any position on the road whose state is adjusted from an obstacle in a maze to an obstacle in a maze, the position of the adjacent position of the adjacent peripheral position in the maze where the state is an obstacle in the maze is used as the new target position, and the new target position is added to the queue to be processed.

[0085] Correspondingly, in the process of adjusting the positions in the queue to be processed, for any position on the road whose state is adjusted from an obstacle in a maze to an obstacle in a maze, if there is no position with a state of an obstacle in a maze among the adjacent positions of the adjacent surrounding positions in the maze, there is no need to determine the target position and subsequent processing can be continued directly, such as adjusting the states of other positions in the queue to be processed.

[0086] Exemplarily, any position is (u, t). In the maze, the adjacent surrounding positions of the position (u, t) are (u+1, t), (u-1, t) and (u, t+1). Since (u, t-1) exceeds the boundary of the maze, the adjacent surrounding positions of the position (u, t) in the maze do not include (u, t-1). Among them, the adjacent position of (u+1, t) is (u+2, t), the adjacent position of (u-1, t) is (u-2, t), and the adjacent position of (u, t+1) is (u, t+2). Among (u+2, t), (u-2, t) and (u, t+2), the state of (u+2, t) is an obstacle in the maze, and the states of (u-2, t) and (u, t+2) are both the roads of the maze. Then, (u+2, t) is used as the new target position, and (u+2, t) is added to the queue to be processed.

[0087] In one possible implementation, after any position is removed from the queue to be processed, if the number of positions in the queue to be processed is 0, regardless of whether the states of a random number of positions have been adjusted, the adjustment of the states of the positions in the queue to be processed is stopped, and the queue to be processed is reinitialized according to the changed user position, and the states of the positions in the queue to be processed are adjusted.

[0088] In another possible implementation, after any position is removed from the queue to be processed, if the number of positions in the queue to be processed is 0, then it is determined whether all positions in the maze have entered the queue to be processed. If all positions in the maze have entered the queue to be processed, it is determined whether there is a position in the maze whose status is the exit of the maze. If there is a position in the maze whose status is the exit of the maze, a maze is generated according to the status of each position of the current maze. If there is no position in the maze whose status is the exit of the maze, the status of any position is adjusted to the exit of the maze. Correspondingly, if there is a position in the maze that has not entered the queue to be processed, the status of the position in the queue to be processed continues to be adjusted according to the changed user position.

[0089] In this way, when the status of each position in the maze has entered the queue to be processed, it can be processed separately according to whether there is an exit in the maze, which can ensure the integrity of the generated maze, that is, the generated maze has a corresponding exit.

[0090] Step 102: Generate a maze based on the states of each position in the adjusted maze.

[0091] Before executing step 102, or after executing step 101, it is determined whether all positions in the maze have entered the queue to be processed. If all positions in the maze have entered the queue to be processed, there is no position in the maze that is the exit of the maze, and the state of the last position removed from the queue to be processed is adjusted to the exit of the maze. Through this process, the final generated maze can contain an exit, ensuring the integrity of the generated maze.

[0092] It should be noted that, through the above process, the state of each position in the maze is adjusted according to the user's position, and based on the adjusted state of each position in the maze, a maze with high variability generated according to the user's position is generated.

[0093] In one possible implementation, before adjusting the status of each position in the maze based on the user's position, in addition to the user's position, the number of steps the user has taken in the maze, and the status of each position in the maze, it is also necessary to first obtain information about the size of the maze, the queue to be processed, and the global status of the blockchain.

[0094] The queue to be processed is a new queue to be processed obtained after initialization processing according to the user position.

[0095] In addition, for example, for a rectangular maze, the size information of the maze is the length m and width n of the maze. At this time, in the position (i, j) in the rectangular maze, the value of i can be a positive integer less than or equal to m, j can be a positive integer less than or equal to n, and m and n are both positive integers.

[0096] Correspondingly, the above-mentioned maze information contract includes the user's location, the number of steps the user has taken in the maze, the status of each position in the maze, the size information of the maze, the queue to be processed, and the global status of the blockchain.

[0097] For example, Figure 2 As shown, the size of the rectangular maze is n*m, where n=5 and m=3. Figure 2 There are 15 positions (1, 1) ... (5, 3) in total, that is, each position in the maze is Figure 2 The grids shown correspond to each other, and each grid corresponds to a state.

[0098] For example, in Figure 2 In a maze of the size shown in FIG. 1 , the user position (3, 2) is obtained, and the number of steps the user has taken in the maze is 0. Then, the states of each position in the maze are initialized according to the user position (3, 2), and the following is obtained: Figure 3The states of each position in the maze shown in FIG. W represents an obstacle in the maze, and S0 represents the entrance to the maze. At this time, according to the user position (3, 2), the initialized queue Q to be processed is determined. The queue Q to be processed includes the position (2, 2), the position (3, 1), the position (3, 3) and the position (4, 2). The states of these four positions in the queue to be processed are all obstacles in the maze.

[0099] Exemplarily, according to the above steps Figure 3 In the process of adjusting the status of each position in the maze shown, the random number is determined to be 2 based on the global state of the blockchain. Among the positions (2, 2), (3, 1), (3, 3) and (4, 2) of the queue Q to be processed, the status of two positions, namely, position (2, 2) and position (3, 1), are adjusted to the path of the maze, that is, P represents the path of the maze, and the status of position (3, 3) remains unchanged. Among them, the adjacent position (0, 2) of the adjacent peripheral position (1, 2) of position (2, 2) exceeds the boundary of the maze, and the adjacent peripheral position (3, 0) of position (3, 1) and the adjacent position (3, -1) of position (3, 0) both exceed the boundary of the maze, then there is no new target position added to the queue Q to be processed. At this time, we get the following: Figure 4 The states of various positions in the maze are shown.

[0100] For example, in getting Figure 4 After the maze shown in the figure, the user's position changes to (2, 2). At this time, a new queue Q is initialized and a random number 3 is determined based on the global state of the blockchain. The queue Q includes positions (1, 2), (2, 3) and (2, 1). At this time, the state of position (1, 2) is adjusted to P, and the states of positions (2, 3) and (2, 1) remain unchanged. At this time, the following is obtained: Figure 5 The states of various positions in the maze are shown.

[0101] For example, after all positions have entered the queue to be processed, the status of each position in the maze is obtained as follows: Figure 6 As shown, at this time, position (5, 3) is the last position removed from the maze. There is no position in the maze that is the exit of the maze. This state is represented by S t Therefore, the state of position (5, 3) is adjusted to the exit of the maze. Finally, we get Figure 7 The maze shown. Figure 7 The black part shown in the figure is an obstacle in the maze, such as a maze wall, and the white part is a path in the maze, that is, a part that a user can pass through in the maze.

[0102] In a possible implementation, in the process of adjusting the status of each position in the maze at one time, the number of user positions can be multiple, and the multiple user positions correspond to users one by one. The process of adjusting the status of each position in the maze according to multiple user positions is similar to the process of adjusting the status of each position in the maze according to one user position in the above step 101, and will not be repeated here.

[0103] It should be noted that the above method can also be used to generate a three-dimensional maze with strong variability to enhance the interest of the generated maze.

[0104] like Figure 8 As shown, an embodiment of the present application provides a maze generating device, which includes an adjustment module 801 and a generating module 802.

[0105] Among them, the adjustment module 801 is used to adjust the state of each position in the maze based on the user's position to obtain the adjusted state of each position in the maze; the state is used to represent the entrance, exit, road and obstacle of the maze.

[0106] The generation module 802 is used to generate a maze based on the adjusted status of each position in the maze.

[0107] like Fig. 9 As shown, an embodiment of the present application provides an electronic device, including a processor 901, a communication interface 902, a memory 903 and a communication bus 904, wherein the processor 901, the communication interface 902, and the memory 903 communicate with each other through the communication bus 904.

[0108] Memory 903, used for storing computer programs;

[0109] In one embodiment of the present application, the processor 901 is used to implement the steps of the maze generation method provided by any of the aforementioned method embodiments when executing the program stored in the memory 903.

[0110] An embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps of the maze generation method provided in any of the aforementioned method embodiments are implemented.

[0111] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0112] The foregoing is merely a specific embodiment of the present invention, which enables those skilled in the art to understand or implement the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features claimed herein.

Claims

1. A maze generation method, characterized in that: The method comprises: The state of each position in the maze is adjusted based on the user position to obtain the adjusted state of each position in the maze; the state is used to represent the entrance, exit, road and obstacle of the maze, including: initializing the position in the queue to be processed according to the user position, performing the following operations on any position in the queue to be processed, and removing any position from the queue to be processed until a random number of any positions are removed from the queue to be processed: if there is no position in the maze whose state is the exit of the maze, then adjusting the state of any position from the obstacle of the maze to the exit of the maze with a preset probability, or adjusting the state of any position from the obstacle of the maze to the road of the maze; if there is a position in the maze whose state is the exit of the maze, then adjusting the state of any position from the obstacle of the maze to the road of the maze; A maze is generated based on the states of each position in the adjusted maze.

2. The maze generation method according to claim 1, characterized in that: Before adjusting the state of each position in the maze based on the user position to obtain the adjusted state of each position in the maze, the method further includes: Get a maze information contract, which is used to store the user's location, the number of steps the user has taken in the maze, and the status of each location in the maze.

3. The maze generation method according to claim 2, characterized in that: Before adjusting the state of each position in the maze based on the user position to obtain the adjusted state of each position in the maze, the method further includes: If the number of steps taken by the user in the maze is 0, the state of each position in the maze is initialized to obtain the initialization state of each position in the maze, and the step of adjusting the state of each position in the maze based on the user's position to obtain the adjusted state of each position in the maze is executed.

4. The maze generation method according to claim 3, characterized in that: The state of each position in the maze is adjusted based on the user's position, and the adjusted state of each position in the maze is obtained, including: The positions in the queue to be processed are initialized according to the user position, and the states of the positions in the queue to be processed are adjusted according to the states of the positions in the maze to obtain the adjusted states of the positions in the maze.

5. The maze generation method according to claim 4, characterized in that: Initialize the position in the queue to be processed according to the user's position, including: Determine adjacent peripheral positions of the user position in the maze, and select a position that has not entered the queue to be processed from the adjacent peripheral positions as a target position; Initialize the position in the queue to be processed as the target position.

6. The maze generation method according to claim 4, characterized in that: The step of adjusting the status of the positions in the queue to be processed according to the status of each position in the maze includes: Perform the following operations on any position in the queue to be processed, and remove the any position from the queue to be processed, until a random number of the any positions are removed from the queue to be processed: If the state of any position is the exit, entrance or road of the maze, the state of any position is kept unchanged; If the state of any of the positions is an obstacle in the maze, the state of any of the positions is adjusted.

7. The maze generation method according to claim 6, characterized in that: The random number is determined using the global state of the blockchain as a seed.

8. The maze generation method according to claim 1, characterized in that: After adjusting the state of any one of the positions, the method further includes: If the state of any position changes from an obstacle in the maze to a path in the maze, the position in the queue to be processed is adjusted.

9. The maze generation method according to claim 8, characterized in that: The adjusting the position in the queue to be processed includes: The position of the obstacle in the maze among the adjacent positions of the adjacent peripheral positions of the any position in the maze is used as a new target position; The new target location is added to the queue to be processed.

10. The maze generation method according to claim 4, characterized in that: The method further comprises: If all positions in the maze have entered the queue to be processed, and there is no position in the maze whose status is the exit of the maze, the status of the last position removed from the queue to be processed is adjusted to the exit of the maze.

11. A maze generating device, characterized in that: The maze generating device comprises: An adjustment module is used to adjust the state of each position in the maze based on the user position to obtain the state of each position in the maze after adjustment; the state is used to represent the entrance, exit, road and obstacle of the maze, including: initializing the position in the queue to be processed according to the user position, performing the following operations on any position in the queue to be processed, and removing any position from the queue to be processed until a random number of any positions are removed from the queue to be processed: if there is no position in the maze whose state is the exit of the maze, then adjusting the state of any position from the obstacle of the maze to the exit of the maze with a preset probability, or adjusting the state of any position from the obstacle of the maze to the road of the maze; if there is a position in the maze whose state is the exit of the maze, then adjusting the state of any position from the obstacle of the maze to the road of the maze; The generation module is used to generate a maze based on the states of each position in the adjusted maze.

12. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; The processor is used to implement the steps of the maze generation method described in any one of claims 1 to 10 when executing the program stored in the memory.

13. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the maze generation method according to any one of claims 1 to 10 are implemented.

Citation Information

Patent Citations

  • Cloud control method and system for convertible maze

    CN106209950A

  • Method and device for randomly generating maze map

    CN111494958A