Skip to content

Commit 8cd601f

Browse files
authored
Update README.md
1 parent f74ed3e commit 8cd601f

File tree

1 file changed

+48
-1
lines changed

1 file changed

+48
-1
lines changed

README.md

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ For the representation of a maze a two nested vector is used.
77

88

99

10-
<img src="https://user-images.githubusercontent.com/73026669/157827590-874d57e2-23e4-49e6-9162-1b4d2be29f89.gif" align="left" width="700x"/>
10+
<img src="https://user-images.githubusercontent.com/73026669/157827590-874d57e2-23e4-49e6-9162-1b4d2be29f89.gif" align="left" width="700px"/>
1111

1212

1313

@@ -205,3 +205,50 @@ what happens:
205205

206206
https://github.com/LukeProducts/AStar-Pathfinding-Cpp/blob/8488ab52bc5d2b31ab3f91f949e09666c714fe90/examples/prepare_maze.cpp#L36-L44
207207

208+
------------------------------------------------
209+
210+
<h3> <a href="https://github.com/LukeProducts/AStar-Pathfinding-Cpp/blob/main/AStar.hpp#L454-L480">readmaze</a> - function </h3>
211+
212+
readmaze reads in a maze from the consoles cin stream, <br>
213+
the first line must consist of two integers that indicate the height and width of the mazes to be read in. <br>
214+
In the following you can pass in the maze like this: <br>
215+
216+
```
217+
10 10 // first 10 = m = rows, second 10 = n = columns
218+
##########
219+
# #
220+
# ##### ##
221+
# ## ##
222+
# ## ####
223+
# ### #
224+
# # ## #
225+
### ## #
226+
## ## ##
227+
##########
228+
229+
```
230+
readmaze converts this directly to the maze format by calling the prepare_maze - function, <br>
231+
which Astar() needs, <br>
232+
so in the one with ones and zeros:
233+
```
234+
1111111111
235+
1000000001
236+
1011111011
237+
1011000011
238+
1011001111
239+
1011100001
240+
1001001101
241+
1110011001
242+
1100110011
243+
1111111111
244+
```
245+
246+
so you can pass in the return value vector\<vector\<int>> directly into the AStar - function:
247+
248+
https://github.com/LukeProducts/AStar-Pathfinding-Cpp/blob/main/examples/readmaze.cpp#L10-L16
249+
250+
the disatvantage here is, that because readmaze converts the ascii maze into a numeric one at one time, <br>
251+
you must know the start and end position before, <br>
252+
you would hardcode them, <br>
253+
but that's probably not, what you want. <br><br>
254+
So theres the pardon readunpreparedmaze presented in the following.

0 commit comments

Comments
 (0)